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 |
|
dajonx
Starting Member
6 Posts |
Posted - 2008-04-16 : 10:51:12
|
| Hi,Is there a way to drop a column identity using TSQL? Also, does this code look correct?declare @max1 intdeclare @max2 intselect @max1 = max(acid) from cms_2aalter table cms_3a add cwid int identity(@max1, 1) <------ Errorselect @max2 = max(cwid) from cms_3aalter table cms_4a add cwtid int identity(@max2, 1) <------ ErrorI do not have identities on tables cms_3a and cms_4a, but I do have an identity on cms_2a.Thank you! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-16 : 11:00:19
|
| I think error is because you pass variables inside identity. you may need to use dynamic sql for this. why are you setting maximum value from table cms_2a as seed value? |
 |
|
|
dajonx
Starting Member
6 Posts |
Posted - 2008-04-16 : 11:04:31
|
| Oh, you can't pass variables inside identities? I needed the maximum ID from acid on table cms_2a and start an identity on table cms_3a starting from the maximum ID in cms_2a. |
 |
|
|
dajonx
Starting Member
6 Posts |
Posted - 2008-04-16 : 16:09:17
|
| Does anyone know a way to do this? |
 |
|
|
|
|
|