insert fix_all_ident into table scripts


DELETE scripts
WHERE name = 'fix_all_ident'
GO
INSERT scripts 
VALUES('fix_all_ident','GO')
INSERT scripts 
VALUES('fix_all_ident','CREATE PROCEDURE #fix_all_ident AS')
INSERT scripts 
VALUES('fix_all_ident','DECLARE @objname VARCHAR(30),')
INSERT scripts 
VALUES('fix_all_ident','        @objid INT,')
INSERT scripts 
VALUES('fix_all_ident','        @lastobjid INT,')
INSERT scripts 
VALUES('fix_all_ident','        @cmd VARCHAR(80)')
INSERT scripts 
VALUES('fix_all_ident','SET NOCOUNT ON')
INSERT scripts 
VALUES('fix_all_ident','SELECT @objid = 1')
INSERT scripts 
VALUES('fix_all_ident','SELECT @lastobjid = 0')
INSERT scripts 
VALUES('fix_all_ident','WHILE @objid IS NOT NULL')
INSERT scripts 
VALUES('fix_all_ident','  BEGIN')
INSERT scripts 
VALUES('fix_all_ident','    SELECT @objid = (SELECT MIN(id) FROM sysobjects')
INSERT scripts 
VALUES('fix_all_ident','                     WHERE id > @lastobjid')
INSERT scripts 
VALUES('fix_all_ident','                     AND type = "U")')
INSERT scripts 
VALUES('fix_all_ident','    SELECT @objname = OBJECT_NAME(@objid)')
INSERT scripts 
VALUES('fix_all_ident','    IF (SELECT c.name')
INSERT scripts 
VALUES('fix_all_ident','        FROM syscolumns c, systypes t')
INSERT scripts 
VALUES('fix_all_ident','        WHERE c.id = @objid')
INSERT scripts 
VALUES('fix_all_ident','        AND c.usertype *= t.usertype')
INSERT scripts 
VALUES('fix_all_ident','        AND (c.status & 128) = 128) IS NOT NULL')
INSERT scripts 
VALUES('fix_all_ident','          BEGIN')
INSERT scripts 
VALUES('fix_all_ident','            SELECT @cmd = "DBCC CHECKIDENT(" + @objname + ")"')
INSERT scripts 
VALUES('fix_all_ident','            EXEC (@cmd)')
INSERT scripts 
VALUES('fix_all_ident','          END')
INSERT scripts 
VALUES('fix_all_ident','    SELECT @lastobjid = @objid')
INSERT scripts 
VALUES('fix_all_ident','  END')
INSERT scripts 
VALUES('fix_all_ident','GO')
INSERT scripts 
VALUES('fix_all_ident','EXEC #fix_all_ident')