hi,
I have one database for eg 300 table ,i have delete specify the 200 table data only and then reseed identity the delete table .
but error withshown .
- DECLARE @DeleteTableStatement nvarchar(max)
- DECLARE C2 CURSOR READ_ONLY
- FOR
- SELECT 'Delete From [dbo].[' + TABLE_NAME + ']' from INFORMATION_SCHEMA.TABLES
- WHERE TABLE_SCHEMA = 'dbo' and TABLE_NAME NOT IN ('xxx',
- 'aaa',
- 'bbb',
- etc
- )
- OPEN C2
- FETCH NEXT FROM C2 INTO @DeleteTableStatement
- WHILE @@FETCH_STATUS = 0
- BEGIN
-
- PRINT 'Executing ' + @DeleteTableStatement
- execute sp_executesql @DeleteTableStatement
- DBCC CHECKIDENT (@DeleteTableStatement, RESEED,1);
- FETCH NEXT FROM C2 INTO @DeleteTableStatement
-
- END
- CLOSE C2
- DEALLOCATE C2