Pages

Monday, May 20, 2013

Useful scripts for database migration




 DECLARE @name nvarchar(50);
   DECLARE tableCursor CURSOR FOR
       SELECT name
FROM sys.Tables

  OPEN tableCursor

  FETCH NEXT FROM tableCursor into @name

  WHILE @@FETCH_STATUS = 0
  BEGIN
 
 

         PRINT @name

     --exec( 'drop table ['+@name+']');

        exec( 'select top 1000 * from  "'+@name+'"');

    FETCH NEXT FROM tableCursor into @name

  end  
  CLOSE tableCursor;
  DEALLOCATE tableCursor;
  go

No comments:

Post a Comment