Reputation: 447
I would like to add one milisecond to column in insert statement. My query is below:
INSERT INTO table (
ID
,NAME
,DATE_FROM,
) SELECT
ID
,name
,DATE_FROM + 1ms
FROM table
Syntax "DATE_FROM + 1ms" is not correct. How can I add 1 ms in this column?
Upvotes: 0
Views: 44
Reputation: 70638
You need to use DATEADD()
:
INSERT INTO dbo.YourTable (
ID
,NAME
,DATE_FROM,
) SELECT
ID
,name
,DATEADD(MILLISECOND,1,DATE_FROM)
FROM dbo.YourTable;
Upvotes: 1
Reputation: 31239
You could do this:
INSERT INTO table (
ID
,NAME
,DATE_FROM,
) SELECT
ID
,name
,DATEADD(millisecond, 1, DATE_FROM)
FROM table
In this case you can add a millisecond using the DATEADD.
Reference:
Upvotes: 3