sql执行存储过程 如何输出结果
我的SQL存储过程如下,然而我希望它最终能输出我if判断下的select语句内容,它却总是告诉我“命令已成功完成。”怎样修改才能让他输出select语句中的内容呢?alt...
我的SQL存储过程如下,然而我希望它最终能输出我if判断下的select语句内容,它却总是告诉我“命令已成功完成。”怎样修改才能让他输出select语句中的内容呢?
alter procedure ticket_specific_info
@userNo as varchar(20),@serviceNo as char(10)
as
begin
select @serviceNo=serviceNo from ticketInfo where userNo=@userNo
if @serviceNo ='service00002'
begin
select ticketSum*commercialPrice as '机票费用',departCity as '出发城市',arrivalCity as'到达城市',departTime as '出发时间',
arrivalTime as '到达时间',departDate as '出发日期',arrivalDate as '到达日期'
from ticketInfo ti, airlineInfo ai, userInfo ui
where ti.userNo=ui.userNo and ui.userNo=@userNo
end
else if @serviceNo ='service00001'
begin
select ticketSum*commonPrice as '机票费用',departCity as '出发城市',arrivalCity as'到达城市',departTime as '出发时间',
arrivalTime as '到达时间',departDate as '出发日期',arrivalDate as '到达日期'
from ticketInfo ti, airlineInfo ai, userInfo ui
where ti.userNo=ui.userNo and ui.userNo=@userNo
end
end 展开
alter procedure ticket_specific_info
@userNo as varchar(20),@serviceNo as char(10)
as
begin
select @serviceNo=serviceNo from ticketInfo where userNo=@userNo
if @serviceNo ='service00002'
begin
select ticketSum*commercialPrice as '机票费用',departCity as '出发城市',arrivalCity as'到达城市',departTime as '出发时间',
arrivalTime as '到达时间',departDate as '出发日期',arrivalDate as '到达日期'
from ticketInfo ti, airlineInfo ai, userInfo ui
where ti.userNo=ui.userNo and ui.userNo=@userNo
end
else if @serviceNo ='service00001'
begin
select ticketSum*commonPrice as '机票费用',departCity as '出发城市',arrivalCity as'到达城市',departTime as '出发时间',
arrivalTime as '到达时间',departDate as '出发日期',arrivalDate as '到达日期'
from ticketInfo ti, airlineInfo ai, userInfo ui
where ti.userNo=ui.userNo and ui.userNo=@userNo
end
end 展开
2015-06-17
展开全部
就是这样输出的用select就可以了,细节你在检查一下,看看是不是符合if的条件。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询