日期:2014-05-17  浏览次数:20582 次

大师们求救啊
ALTER proc [dbo].[up_selectticket]
(@start varchar(20),@arrive varchar(20),@traintypeid char(20), @ddl1 int,@ddl2 int)
as
SELECT T_trainnumber.trainid AS 车次, T_trainnumber.gotime AS 出发时间, T_traintype.trainname AS 类别, 
T_seattype.seattypename AS 座位, T_trainticket.startsite AS 发站, T_trainticket.arrivesite AS 到站, 
T_trainticket.ticketprice AS 价格, T_trainnumber.businessbase_num AS 商务座, T_trainnumber.fristseat_num AS 一等座,
 T_trainnumber.secondseat_num AS 二等座, T_trainnumber.hardseat_num AS 硬座, T_trainnumber.nullseat_num AS 无座, 
T_trainticket.ticketID AS 车票ID FROM T_trainnumber INNER JOIN T_traintype ON
 T_trainnumber.traintypeid = T_traintype.traintypeid INNER JOIN T_trainticket ON 
T_trainnumber.trainid = T_trainticket.trainid INNER JOIN T_seattype ON
 T_trainticket.seattypeid = T_seattype.seattypeid WHERE (T_trainticket.startsite = @start) AND
 (T_trainticket.arrivesite = @arrive) AND (T_traintype.traintypeid like @traintypeid) AND (YEAR(T_trainnumber.gotime) = 2012)
 AND (MONTH(T_trainnumber.gotime) = @ddl1) AND (DAY(T_trainnumber.gotime) = @ddl2)


exec up_selectticket @start='北京',@arrive='上海',@traintypeid='000[1234]',@ddl1=6,@ddl2=20



这个存储过程怎么把参数直接带进去,有数据的,按照上面这样写反而没数据了呢

------解决方案--------------------
这个存储过程是在是让人汗颜