Emad GabrielThoughts, tips and shortcuts about building software
Tips

Add Identity Column to Table created by SELECT INTO

An Easy way to add an Identity column to a table created by SELECT .. INTO is:

 

Assume the table is created using

SELECT NAME INTO NAMES2 FROM NAMES1

 

simply add this,

SELECT IDENTITY(INT, 1,1) AS [ID], NAME INTO NAMES2 FROM NAMES1