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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Changing the data type and constraint

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-05-18 : 08:30:37
carlos writes "I have a field in a table witch is a varchar(50) i want to change that field to be an int field with IDENTITY as well as the PRIMARY key. I have done some testing using the follwing script:

alter table callhist drop column customdata1
alter table callhist add customdata1 int identity (1,1)
CONSTRAINT [PK_customdata1] PRIMARY KEY CLUSTERED
(
[customdata1]
)

Is there any way I can do the same without having to drop the column first?

Thanks,

Carlos"

nr
SQLTeam MVY

12543 Posts

Posted - 2004-05-18 : 08:43:48
Don't think you can add the identity property to an existing column.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

carango
Starting Member

1 Post

Posted - 2004-05-18 : 10:36:33
Thank, that's what i thougth
Go to Top of Page
   

- Advertisement -