I'm doing an INSERT INTO query in order to initialize a new table. The primary key is RFQ_ID and Action_Time
How could add 1 millisecond to each Action_Time on a 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
Adding only 1 millisecond wont work as the datetime values in SQL are rounded to increments of .000, .003, or .007 second. SO if you are going to add only 1 millisecond in any date time value there shall not be any impact on the original datetime.
You need to add minimum 2 milliseconds in the datetime so that the new datetime can be rounded to .003 and your implemnentations will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With