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 |
|
Bex
Aged Yak Warrior
580 Posts |
Posted - 2009-01-12 : 13:47:41
|
| I am trying to alter an identity column using dynamic sql, but get the following error:Msg 156, Level 15, State 1, Line 2Incorrect syntax near the keyword 'IDENTITY'.ALTER TABLE crdm.Header_20090111ALTER COLUMN TransactionID BIGINT IDENTITY (3,1)Is this not possible?ThanksHearty head pats |
|
|
Skorch
Constraint Violating Yak Guru
300 Posts |
Posted - 2009-01-12 : 13:56:30
|
| I think you may have to remove the identity and re-add it to alter it |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-12 : 14:23:26
|
| Why dynamic sql? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-13 : 00:21:51
|
| http://www.mssqltips.com/tip.asp?tip=1397 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-01-13 : 01:38:03
|
quote: Originally posted by Bex I am trying to alter an identity column using dynamic sql, but get the following error:Msg 156, Level 15, State 1, Line 2Incorrect syntax near the keyword 'IDENTITY'.ALTER TABLE crdm.Header_20090111ALTER COLUMN TransactionID BIGINT IDENTITY (3,1)Is this not possible?ThanksHearty head pats
But the code you posted is non-dynamicYou cant alter the column to have a identity propertyMadhivananFailing to plan is Planning to fail |
 |
|
|
Bex
Aged Yak Warrior
580 Posts |
Posted - 2009-01-13 : 05:04:05
|
| Hi allThank you for your replies. SOrry for not replying sooner, but I had gone home.To answer some of your questions:Example code not dynamic:That was just for ease of posting. Why dynamic:Long story, but I have to generate a DB scheme to emulate partitioning (with a different partition each day). Therefore, the code has to create the tables using template examples, and recreate all constraints, keys, etc, but using different names based on dates. Hope that makes sense???THanks for the link, I think that concludes what Skorch said, I shall have to drop and recreate the column.Thanks guysHearty head pats |
 |
|
|
|
|
|
|
|