日期:2014-05-18  浏览次数:20625 次

怎么向datetime类型字段插入数值。
create   table   node(id   int   not   null   primary   key   ,Name   varchar   not   null,age   varchar   not   null,birthday   datetime   not   null);

insert   into   node   values(001, 'xruiqi ',24, '1981-11-28   4:22:33 ')

------解决方案--------------------
declare @t table(date datetime)
insert into @t select getdate()
insert into @t select '2007-07-08 16:09:36.920 '

select * from @t
------解决方案--------------------
象这样的字符串,就可以插入到datetime字段中:
'2007/01/23 '
------解决方案--------------------
LZ的SQL语句没有什么大问题,INSERT INTO语句 是对的

错在CREATE TABLE时有问题,
create table node(id int not null primary key ,Name varchar(10) not null,age varchar(10) not null,birthday datetime not null);

定义varchar没有指定长度