begin declare @types int,@tmplx nvarchar(10),@tmplx2 nvarchar(10) set @types=3 if @types=0 begin set @Tmplx ='1,2,3,4' set @Tmplx2 ='1,2,3,4,' end if @types=1 begin set @Tmplx ='1' set @Tmplx2 ='1,2,3,4' end if @types=2 begin set @Tmplx ='2' set @Tmplx2 ='1,2,3,4' end if @types=3 begin set @Tmplx ='3' set @Tmplx2 ='1,2,3,4' end if @types=4 begin set @Tmplx ='4' set @Tmplx2 ='1,2,3,4' end if @types=5 begin set @Tmplx ='1,2,3,4' set @Tmplx2 ='5' end print @tmplx print @tmplx2end 3 1,2,3,4
begin if @types=0 begin set @Tmplx ='1,2,3,4' set @Tmplx2 ='1,2,3,4,' end if @types=1 begin set @Tmplx ='1' set @Tmplx2 ='1,2,3,4' endendif里面用 begin...end
begin if @types=0 begin set @Tmplx ='1,2,3,4' set @Tmplx2 ='1,2,3,4,' end if @types=1 begin set @Tmplx ='1' set @Tmplx2 ='1,2,3,4' end if @types=2 begin set @Tmplx ='2' set @Tmplx2 ='1,2,3,4' end if @types=3 begin set @Tmplx ='3' set @Tmplx2 ='1,2,3,4' end if @types=4 begin set @Tmplx ='4' set @Tmplx2 ='1,2,3,4' end if @types=5 begin set @Tmplx ='1,2,3,4' set @Tmplx2 ='5' endend
begin
declare @types int,@tmplx nvarchar(10),@tmplx2 nvarchar(10)
set @types=3
if @types=0
begin
set @Tmplx ='1,2,3,4'
set @Tmplx2 ='1,2,3,4,'
end
if @types=1
begin
set @Tmplx ='1'
set @Tmplx2 ='1,2,3,4'
end
if @types=2
begin
set @Tmplx ='2'
set @Tmplx2 ='1,2,3,4'
end
if @types=3
begin
set @Tmplx ='3'
set @Tmplx2 ='1,2,3,4'
end
if @types=4
begin
set @Tmplx ='4'
set @Tmplx2 ='1,2,3,4'
end
if @types=5
begin
set @Tmplx ='1,2,3,4'
set @Tmplx2 ='5'
end
print @tmplx
print @tmplx2end
3
1,2,3,4
begin
if @types=0
begin
set @Tmplx ='1,2,3,4'
set @Tmplx2 ='1,2,3,4,'
end
if @types=1
begin
set @Tmplx ='1'
set @Tmplx2 ='1,2,3,4'
endendif里面用 begin...end
begin
if @types=0
begin
set @Tmplx ='1,2,3,4'
set @Tmplx2 ='1,2,3,4,'
end
if @types=1
begin
set @Tmplx ='1'
set @Tmplx2 ='1,2,3,4'
end
if @types=2
begin
set @Tmplx ='2'
set @Tmplx2 ='1,2,3,4'
end
if @types=3
begin
set @Tmplx ='3'
set @Tmplx2 ='1,2,3,4'
end
if @types=4
begin
set @Tmplx ='4'
set @Tmplx2 ='1,2,3,4'
end
if @types=5
begin
set @Tmplx ='1,2,3,4'
set @Tmplx2 ='5'
endend