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 |
|
Jose Miguel
Starting Member
3 Posts |
Posted - 2007-04-30 : 12:34:54
|
| Hello,I have the following script:ALTER TABLE [dbo].[Report_Comments_Table] [Comment_Number] WITH NOCHECK ADD CONSTRAINT [PK_Report_Comments_Table] PRIMARY KEY CLUSTERED ([Comment_Number]) ON [PRIMARY] GOI want to set the Identity property to "Off" or "No" on my primary key. How could I alter the above for that? Please help!Jose |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-30 : 12:36:01
|
| set identity_insert {tablename} ON | OFFPeter LarssonHelsingborg, Sweden |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-04-30 : 12:37:38
|
| You set the property to ON to manually enter the values. What are you trying to do? Can you explain in more detail?Dinakar NethiSQL Server MVP************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
Jose Miguel
Starting Member
3 Posts |
Posted - 2007-04-30 : 13:56:58
|
| This should just be setting Comment_Number as the primary key, then . However, when we ran the script we ran into errors. Setting Identity to "No" in Enterprise Manager seemed to fix everything. However, I need to submit the SQL-Transact code for this. |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-04-30 : 13:58:44
|
| Are you sending the values for the column manually or do you want SQL Server to assign a value?Dinakar NethiSQL Server MVP************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-04-30 : 14:37:53
|
| I don't think we are heading in the correct direction in this thread. I think the poster is asking how to turn off the identity option on the column. This isn't done on the primary key constraint. You can't just alter the table.To do it, you must build another table with the layout that you want, copy your data to this new table, add the constraints and indexes to this new table, drop the old table, rename the new table to the old table. This can be pretty cumbersome to write from scratch, so what I do is have Management Studio write the code for me by going into design mode, making the change, saving the script, and then saying no I don't want to save the change to the table. Jose Miguel,Please correct me if I am wrong on what I think you want.Tara Kizerhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
|
|
|
|
|