/ Published in: SQL
URL: http://snipplr.com/login/
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
declare @StartNumber int = 1000 INSERT INTO Table2 SELECT (ROW_NUMBER() OVER(ORDER BY [FIELD] DESC)) + @StartNumber AS id, * FROM Table1
You need to login to post a comment.
