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 |
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2006-12-06 : 16:04:55
|
Hello, I have a column that is not auto-incremented. I would like to make it auto-incremented. For the moment, the only solution I found is to delete my column and to add a new auto-incremented column. The problem is I cannot delete it without deleting dependencies on it... So is there a solution to make an existing column auto-incremented or is it necessary to a create a new column ?Thank you in advance for your help. |
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-12-06 : 16:10:59
|
If you do this from Enterprise Manager it will do all the dependencies stuff for you (if required). Just try opening the table in design view and changing the IDENTITY property and see what happens (obviously backup before trying this...)HTH,Tim |
|
|
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2006-12-06 : 16:24:23
|
I use SQL manager 2005. The IDENTITY property is disabled. I cannot modify it. I can change its value only when I create a new column. |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-12-06 : 19:16:36
|
OK then. I would:-script out your dependencies-delete the dependencies-create a new temporary table of identical structure but has your column as an IDENTITY-copy across your data-delete the existing table-rename the temporary table back to the original nameThis is basically what Enterprise Manager does when you try and change a column to an IDENTITY column. You could also add a new IDENTITY column (provided your table doesn't already have one), but I suspect that you'll have to modify the dependant code to point to the new column. HTH,Tim |
|
|
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2006-12-06 : 21:26:12
|
thank you timmy. Perhaps I have to try Enterprise Manager... |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-12-06 : 22:29:12
|
Good idea..... |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-12-07 : 02:57:18
|
Do Enterprise Manager work on SQL 2005 databases?Peter LarssonHelsingborg, Sweden |
|
|
X002548
Not Just a Number
15586 Posts |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-12-07 : 09:55:04
|
Does? Peter LarssonHelsingborg, Sweden |
|
|
|
|
|