1 USE [QG_Mis24] 2 GO 3 4 /****** Object: StoredProcedure [dbo].[p_set1] Script Date: 07/18/2013 13:25:57 ******/ 5 SET ANSI_NULLS ON 6 GO 7 8 SET QUOTED_IDENTIFIER ON 9 GO 10 11 12 13 CREATE procedure [dbo].[p_set1] 14 as 15 declare tb cursor for 16 SELECT sql='DELETE FROM ['+name +']' 17 from sysobjects where xtype='u' 18 AND name NOT like '%_sybz' AND name NOT like '%_pz' AND 19 (name NOT IN 20 ('UserManagement','MenuManagement','t_sycs', 21 'clmcsjb','clmcsjb$','CommonParam','ERPException','gjyc_zj','gjyc_syyb', 22 'sysxxk','LimitUserMenu','SysOrganizations','T_MAC','xmmcwh_cwgl','kszd','gjhj_gjzl','ly_tzk')) 23 order by name desc declare @sql varchar(1000) 24 open tb fetch next from tb into @sql while @@fetch_status = 0 25 begin print @sql 26 exec(@SQL) fetch next from tb into @sql 27 end 28 close tb 29 deallocate tb 30 31 32 33 GO