create table test(id int identity(1,1),col varchar(10)) insert test select 5,'a' insert test select 'b' go sp_configure 'allow update',1 reconfigure with override go update syscolumns set colstat=0 where colstat=1 and id=object_id('test') go sp_configure 'allow update',0 reconfigure with override
CREATE TABLE TE ( T_ID INT IDENTITY(10,1), T_NAME VARCHAR(20) )INSERT TE SELECT 'AA' UNION ALL SELECT 'BBB' ALTER TABLE TE ADD TEMP_ID INT GO UPDATE TE SET TEMP_ID=T_ID GO ALTER TABLE TE DROP COLUMN T_ID GO EXEC SP_RENAME 'TE.TEMP_ID','TE_ID','COLUMN'
create table test(id int identity(1,1),col varchar(10)) insert test select 5,'a' insert test select 'b' go sp_configure 'allow update',1 reconfigure with override go update syscolumns set colstat=0 where colstat=1 and id=object_id('test') go sp_configure 'allow update',0 reconfigure with override
insert test select 5,'a'
insert test select 'b'
go
sp_configure 'allow update',1
reconfigure with override
go
update syscolumns set colstat=0 where colstat=1 and id=object_id('test')
go
sp_configure 'allow update',0
reconfigure with override
(
T_ID INT IDENTITY(10,1),
T_NAME VARCHAR(20)
)INSERT TE SELECT 'AA' UNION ALL
SELECT 'BBB' ALTER TABLE TE
ADD TEMP_ID INT
GO
UPDATE TE SET TEMP_ID=T_ID
GO
ALTER TABLE TE
DROP COLUMN T_ID
GO
EXEC SP_RENAME 'TE.TEMP_ID','TE_ID','COLUMN'
insert test select 5,'a'
insert test select 'b'
go
sp_configure 'allow update',1
reconfigure with override
go
update syscolumns set colstat=0 where colstat=1 and id=object_id('test')
go
sp_configure 'allow update',0
reconfigure with override