sql server - Insert date string to datetime2 in TSQL insert -
i need insert date string datetime2 in queue table in microsoft sql server.
db structure:
create table "queue" ( id int primary key not null, teamid varchar(550) , status varchar(50) , msg varchar(50) , time datetime2, error varchar(10) , ); insert queue values(2,'c33','ok','foundid',convert('tue sep 09 12:18:52 2014' datetime2),'ok');
the value 'tue sep 09 12:18:52 2014' should converted datetime2 format 2014-09-09 12:18:52.000000 , should inserted.
i tried cast , covert fails.
as pointed out syntax convert little off. syntax should below:
select convert(datetime,'sep 09 12:18:52 2014')
Comments
Post a Comment