Adding miliseconds to a datetime in tsql INSERT INTO

Posted by DavRob60 on Stack Overflow See other posts from Stack Overflow or by DavRob60
Published on 2010-04-12T20:25:59Z Indexed on 2010/04/12 20:33 UTC
Read the original article Hit count: 372

Filed under:
|

I'm doing a INSERT INTO query in order to initialize a new table. The primary key is RFQ_ID and Action_Time

How could add 1 milisecond to each Action_Time on new record in order to avoid "Violation of PRIMARY KEY constraint"

INSERT INTO QSW_RFQ_Log
(RFQ_ID, Action_Time, Quote_ID)
SELECT 
  RFQ_ID
  , GETDATE() AS Action_Time
  , Quote_ID
  , 'Added to RFQ on Initialization' AS Note
FROM QSW_Quote

© Stack Overflow or respective owner

Related posts about tsql

Related posts about sql-server-2005