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 |
|
mahesh.vsp
Starting Member
5 Posts |
Posted - 2007-01-04 : 05:12:32
|
| Hi pals,I need to add an identity property for a column using only T-SQL and not Enterprise Manager. I have tried it but i am getting the following error. How to fix it.create table parent (id int, name varchar(20) )-- not nullALTER TABLE parent ALTER COLUMN id int NOT NULL ALTER TABLE parent alter column id int IDENTITY(1,1)I am getting the following error: Server: Msg 156, Level 15, State 1, Line 1Incorrect syntax near the keyword 'identity'.Regards,mahesh |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-01-04 : 05:45:50
|
| You can't alter a column to become IDENTITYYou either need to add it with that attribute initially, or Drop that column and Add a new one (i.e. with the same name) and the Identity propertyKristen |
 |
|
|
mahesh.vsp
Starting Member
5 Posts |
Posted - 2007-01-08 : 00:05:15
|
| Thank you kristenRegards,Mahesh |
 |
|
|
|
|
|