点滴积累【other】---存储过程删除所有表中的数据(sql)

 USE [QG_Mis24]
GO /****** Object: StoredProcedure [dbo].[p_set1] Script Date: 07/18/2013 13:25:57 ******/
SET ANSI_NULLS ON
GO SET QUOTED_IDENTIFIER ON
GO CREATE procedure [dbo].[p_set1]
as
declare tb cursor for
SELECT sql='DELETE FROM ['+name +']'
from sysobjects where xtype='u'
AND name NOT like '%_sybz' AND name NOT like '%_pz' AND
(name NOT IN
('UserManagement','MenuManagement','t_sycs',
'clmcsjb','clmcsjb$','CommonParam','ERPException','gjyc_zj','gjyc_syyb',
'sysxxk','LimitUserMenu','SysOrganizations','T_MAC','xmmcwh_cwgl','kszd','gjhj_gjzl','ly_tzk'))
order by name desc declare @sql varchar(1000)
open tb fetch next from tb into @sql while @@fetch_status = 0
begin print @sql
exec(@SQL) fetch next from tb into @sql
end
close tb
deallocate tb GO
上一篇:luogu P3162 [CQOI2012]组装


下一篇:Python—sys模块介绍