select name from sys.procedures where name='UP_Sys_Oth_ChangeCompanyInfo'
exec sp_helptext 'UP_Sys_Oth_ChangeCompanyInfo'
/*
目的:修改单位信息启用还是未启用状态前先判断该单位下是否有子单位或部门
作者:
时间:2017-02-14
*/
CREATE PROCEDURE UP_Sys_Oth_ChangeCompanyInfo
@retVal nvarchar(400) output,
@ID int,
@Status int
as
begin
declare @childdepcont int
select @childdepcont=count(*) from (
select ID from 表1 where ParentID=@ID union
select ID from 表2 where CompID=@ID
)temp
if(@childdepcont>=0 and @Status=2)
begin
set @retVal=10000123
end
else
begin
set @retVal=0
end
return @retVal
end