//sql逗号分隔的字符串参数截取操作 1 create proc proc_update_userRole 2 (@IDs nvarchar(2000),@RoleID int) 3 as 4 declare @lloca int 5 declare @rloca int 6 declare @ID int 7 set @lloca=1 8 set @rloca=charindex(‘,‘,@IDs,@lloca) 9 while(@rloca is not null and @rloca<>0) 10 begin 11 set @ID= substring(@IDs,@lloca,@rloca-@lloca) 12 set @[email protected]+1 13 set @rloca=charindex(‘,‘,@IDs,@lloca) 14 update sys_UserRoles set [email protected] where R_RoleID in (select RoleID from egb_OrgUser where [email protected]) and R_UserID in(select UserID from egb_OrgUser where AutoID=@ID) 15 update egb_OrgUser set [email protected] where AutoID=@ID 16 end 17 go
时间: 2024-10-13 15:34:10