declare @a varchar(max)='dept1,dept2,dept3,EMP,EmpDup,ExamResult,ggg'
declare @b varchar(max)=''
select @b=@b+'
select * from '+replace(@a,',',' select * from ')
print(@b)
declare @b varchar(max)=''
select @b=@b+'
select * from '+replace(@a,',',' select * from ')
print(@b)
No comments:
Post a Comment