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
本文介绍了一个SQL存储过程UP_Sys_Oth_ChangeCompanyInfo,用于在更改单位信息状态前,检查该单位下是否有关联的子单位或部门。此过程通过计数相关表中的记录来判断单位状态是否可以被改变。
5434

被折叠的 条评论
为什么被折叠?



