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 |
|
intern2424
Yak Posting Veteran
53 Posts |
Posted - 2010-01-28 : 15:11:06
|
| I keep on looking at this statement and can not find what is wrong.alter table check_box_control alter column control_id int not null primary key identityThanks for any help you can give. |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-01-28 : 15:46:23
|
| 2 x "alter" ? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-01-29 : 02:33:17
|
quote: Originally posted by Kristen 2 x "alter" ?
No. Primary key constraint should be added when altering a column to primary keyMadhivananFailing to plan is Planning to fail |
 |
|
|
DaleTurley
Yak Posting Veteran
76 Posts |
Posted - 2010-01-29 : 08:31:53
|
quote: Originally posted by intern2424 I keep on looking at this statement and can not find what is wrong.alter table check_box_control alter column control_id int not null primary key identityThanks for any help you can give.
If you change to;alter table check_box_control alter control_id int not null identity(1,1)Should work to change data type. If you're trying to add a primary key.ALTER TABLE check_box_controlADD CONSTRAINT <PK Name> PRIMARY KEY CLUSTERED |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-30 : 00:32:09
|
quote: Originally posted by DaleTurley
quote: Originally posted by intern2424 I keep on looking at this statement and can not find what is wrong.alter table check_box_control alter column control_id int not null primary key identityThanks for any help you can give.
If you change to;alter table check_box_control alter control_id int not null identity(1,1)Should work to change data type. If you're trying to add a primary key.ALTER TABLE check_box_controlADD CONSTRAINT <PK Name> PRIMARY KEY CLUSTERED
you cant alter an already existing column to make it an identity column. for that you need to apply below work aroundhttp://www.mssqltips.com/tip.asp?tip=1397 |
 |
|
|
chriztoph
Posting Yak Master
184 Posts |
Posted - 2010-05-30 : 22:55:04
|
| try this to edit your tables in using the design interface..you can use this to edit the IsIdentity value of an existing column..http://stevesmithblog.com/blog/sql-server-prevent-saving-changes-that-require-table-to-be-re-created/ |
 |
|
|
|
|
|