--前面的变量省略
begin
select @num=COUNT(1) from sDepartment where DepoID=@DepoID
if @num<1
begin
begin try
begin tran
insert into sDepartment(DepoID, DepName, UpperID, DepFlag, [Status], [Address], LinkMan, LinkPhone, LinkFax, makID, makDtm, RegDtm, modID, modDtm, Remark,scope)values(@DepoID, @DepName, @UpperID, @DepFlag, @Status, @Address, @LinkMan, @LinkPhone, @LinkFax, @makID, GETDATE(), @RegDtm, @modID, GETDATE(), @Remark,@scope)
set @num=@@ROWCOUNT
insert into sDepartmentExt(DepoID,Corporation,EnterLeading,QualityLeading,RunWay,DeptAddr,PermitStaDate,PermitEffdate,PermitLinked,BusiLicenseStaDate,BusiLicenseEffdate,BusiLicense,BusiAnlInsp,TaxReg,OrgCodeStaDate,OrgCodeEffDate,OrgCode,OrgCodeAnlInsp,CircStaDate,CircEffdate,Circ,CircAnlInsp,TaxRegDtm,GspStaDate,GspEffDate,Gsp) values(@DepoID,@Corporation,@EnterLeading,@QualityLeading,@RunWay,@DeptAddr,@PermitStaDate,@PermitEffDate,@PermitLinked,@BusiLicenseStaDate,@BusiLicenseEffDate,@BusiLicense,@BusiAnlInsp,@TaxReg,@OrgCodeStaDate,@OrgCodeEffDate,@OrgCode,@OrgCodeAnlInsp,@CircStaDate,@CircEffDate,@Circ,@CircAnlInsp,@TaxRegDtm,@GspStaDate,@GspEffDate,@Gsp)
set @num=@@ROWCOUNT
-- Author: ljq
-- ALTER DATE: 2014-12-09
-- Description:zai 在添加仓库部门的时候插入系统设置信息
-- ==========================================
INSERT INTO sSettings (depoID, setID, modName,[Name] ,Flag, Scope, [Value], IniSetting, modID, modDtm)
select @DepoID,s.setID,s.modName,s.[Name],s.Flag,s.Scope,s.[Value],s.IniSetting,s.modID,s.modDtm
from sSettings s
where (DepoID='01')
--set @num=@@ROWCOUNT
commit tran
end try
begin catch
set @num=0
rollback tran
end catch
select @num
end
else
set @num=2
select @num
end