Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Update Property on an Identity Column
USE pubs
GO
EXEC sp_configure 'allow update', '1'
RECONFIGURE WITH OVERRIDE
GO
DECLARE @col varchar(128), @table varchar(128)
-- for find identity column (if colstat =1 then identity is on)
SELECT @col=name
FROM syscolumns
WHERE id=OBJECT_ID('pubs..test') AND (colstat & 1 <> 0)
-- SELECT @col
IF (@col IS NOT null) BEGIN
UPDATE syscolumns
SET colstat = colstat ^ 1
WHERE id = OBJECT_ID('pubs..test') and name = @col
END
EXEC sp_configure 'allow update', '0'
RECONFIGURE WITH OVERRIDE
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.