/ Published in: SQL
This code allows you to create an ID field value for inserts into a table that does not auto increment itself
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
DECLARE @StartNumber INT = 1000 INSERT INTO Table2 SELECT (ROW_NUMBER() OVER(ORDER BY [FIELD] DESC)) + @StartNumber AS id, * FROM Table1
URL: http://snipplr.com/login/