Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ninel
Posting Yak Master
141 Posts |
Posted - 2005-11-21 : 14:04:12
|
| I have a table that contains an integer column with data. I would like to alter this column to an identity column. How do I do this? This is a copy of a table that already exists. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-11-21 : 14:07:36
|
go to the EM.choose design table.change the column to identity.click view change script and you'll see what you'd need to do in QA.Go with the flow & have fun! Else fight the flow |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2005-11-21 : 14:09:35
|
d'Oh This is what Enterprise Mangler would do:[CODE]CREATE TABLE dbo.Tmp_myTable99 ( Col1 int NOT NULL IDENTITY (1, 1) ) ON [PRIMARY]GOSET IDENTITY_INSERT dbo.Tmp_myTable99 ONGOIF EXISTS(SELECT * FROM dbo.myTable99) EXEC('INSERT INTO dbo.Tmp_myTable99 (Col1) SELECT Col1 FROM dbo.myTable99 TABLOCKX')GOSET IDENTITY_INSERT dbo.Tmp_myTable99 OFFGODROP TABLE dbo.myTable99GOEXECUTE sp_rename N'dbo.Tmp_myTable99', N'myTable99', 'OBJECT'GO[/CODE]Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
|
|
|