W
wuzhenzhen
Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一个存储过程如下:
create procedure search
(@number int,@parameter char(20))
as
begin
select * from stdstion
where
@parameter=
case
when @number=0 then IDs
when @number=1 then Names
when @number=2 then Gender
when @number=3 then Age
end
end
运行正常,但如果增加when语句变成如下就无法执行了:
create procedure search
(@number int,@parameter char(20))
as
begin
select * from stdstion
where
@parameter=
case
when @number=0 then IDs
when @number=1 then Names
when @number=2 then Gender
when @number=3 then Age
when @number=4 then PoliticsFace
when @number=5 then Nation
when @number=6 then GraduateTS
when @number=7 then DpmDuty
when @number=8 then SpecialName
end
end
为什么?
create procedure search
(@number int,@parameter char(20))
as
begin
select * from stdstion
where
@parameter=
case
when @number=0 then IDs
when @number=1 then Names
when @number=2 then Gender
when @number=3 then Age
end
end
运行正常,但如果增加when语句变成如下就无法执行了:
create procedure search
(@number int,@parameter char(20))
as
begin
select * from stdstion
where
@parameter=
case
when @number=0 then IDs
when @number=1 then Names
when @number=2 then Gender
when @number=3 then Age
when @number=4 then PoliticsFace
when @number=5 then Nation
when @number=6 then GraduateTS
when @number=7 then DpmDuty
when @number=8 then SpecialName
end
end
为什么?