Search This Blog

Monday, November 15, 2010

Reset table id's "O"

use

DECLARE @reset_id varchar(200)




DECLARE reset_cursor CURSOR FOR

select Table_schema+'.'+Table_Name as tname from information_schema.tables

where Table_Type='BASE TABLE'

OPEN reset_cursor;




FETCH NEXT FROM reset_cursor

INTO @reset_id;




WHILE @@FETCH_STATUS = 0

BEGIN




DBCC CHECKIDENT(@reset_id,RESEED,0)

print @reset_id;

FETCH NEXT FROM reset_cursor INTO @reset_id;

END;




CLOSE reset_cursor;

DEALLOCATE reset_cursor;






Also see my other blogs: TreeView using database
                                                                Get Primary key of gridview on edit commant

No comments:

Post a Comment