if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[up_DelHist_FWJS]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[up_DelHist_FWJS]
Go

create procedure up_DelHist_FWJS
@BeginDate varchar(10) ,
@EndDate varchar(10) 
With Encryption
as 


declare @sSql varchar(8000)

set @sSql='delete from FWJSBDetail where JSFormNO in '+
'(select FormNo from FWJSH where CheckType=''3'' and WriteDate>='''+@BeginDate+''' and WriteDate<='''+@EndDate+''')'
exec(@sSql)

set @sSql='delete from FWJSB where FormNO in '+
'(select FormNo from FWJSH where CheckType=''3'' and WriteDate>='''+@BeginDate+''' and WriteDate<='''+@EndDate+''')'
exec(@sSql)

set @sSql='delete  from FWJSH where CheckType=''3'' and WriteDate>='''+@BeginDate+''' and WriteDate<='''+@EndDate+''''
exec(@sSql)

