Just spit it out, because the company is going to deploy a whole new system for new customers, but the company doesn't have an empty library, so it can only back up the databases that are running on the wire, and then empty the data.
Here's a look at what I wrote when I emptied the database. A method of bulk emptying a data table
Idea: Query out all the tables under the library filter out the tables that need to be emptied according to the table name (the system-related data table is named as regular)
Below, on the code
1 Use [DataBase]2 GO3 DECLARE @name varchar( -)4 DECLARE @count int5 Set @count=06 DECLAREContact_cursorCURSOR for7 SelectName fromsysobjects8 whereXtype='u' andName like 'tb_xxx_%'--filter table names based on criteria9 Ten OPENContact_cursor One A - FETCH NEXT fromContact_cursor - into @name--Table name the - while @ @FETCH_STATUS = 0 - BEGIN - Print 'The table has been emptied'+@name + Set @count=@count+1 - exec('TRUNCATE TABLE'+@name) + FETCH NEXT fromContact_cursor A into @name at END - Print 'process completed, total data table emptied'+Convert(varchar( -),@count)+'a' - CLOSEContact_cursor - deallocateContact_cursor - GO
SQL Server uses cursors to bulk empty data tables