Showing posts with label intostatement. Show all posts
Showing posts with label intostatement. Show all posts

Friday, March 23, 2012

Primary Key using Select Into

Is it possible for me to define a Primary Key on a table using a Select Into
statement? If so could someone give me an example of how to do this?> Is it possible for me to define a Primary Key on a table using a Select
> Into
> statement? If so could someone give me an example of how to do this?
SELECT ...
INTO dbo.NewTableName
FROM dbo.OldTableName
GO
ALTER TABLE dbo.NewTableName ADD PRIMARY KEY(ColumnName)
Tom
http://kbupdate.com/sql