Hi friends ,
Suppose i have one table " shipmentpincode " , which have following columns :-
I want to make Id column of this table identity . Then i have to fulfill following steps : -
- First , create a temp column in table
Alter Table shipmentpincode Add Id_new int Identity(1, 1) not null primary key
Go
Exec sp_rename 'shipmentpincode.Id_new', 'Id', 'Column'
- Second, drop existing column
Alter Table shipmentpincode Drop Column Id
Go
- Rename new column to old column name
Exec sp_rename 'shipmentpincode.Id_new', 'Id', 'Column'
0 comments:
Post a Comment