Tag Info

New answers tagged


TRUNCATE TABLE_NAME; does the magic for you.


You should use TRUNCATE instead of DELETE if you is using SQL Server. Because it will reduce log records in log file. USE <your database>; GO DECLARE @table_name varchar(100); DECLARE c CURSOR FOR SELECT name FROM sys.tables WHERE type='U' OPEN c FETCH NEXT FROM c INTO @table_name WHILE @@FETCH_STATUS =0 BEGIN EXEC (N'TRUNCATE TABLE ...


Generate the statements you need select 'DELETE FROM '||table_name||' ;' from user_tables;


One to do the backup and restore (running as an sa) and then creating a separate user that only has access to the PRODCOPY database, that then runs the clean up section of this script. Any thoughts on this? This is a good idea. You can have 2 jobs Perform backup and restore of PROD database to dev environments Once above is completed, kick off the ...

Top 50 recent answers are included