Home > Software engineering >  Create table from select with primary key?
Create table from select with primary key?

Time:10-29

I made a select statement from different tables. Now i need to make out of it an actual table. But i need to add unique Id to all the records. What should i add to my code?

select
...Some Select statement...

into NewTable
from Customer

CodePudding user response:

You can create the identity when you select into

select identity(int, 1, ,1) as ID, other columns...
into NewTable
from Customer
  • Related