用output参数参考:
CREATE PROCEDURE titles_cursor @titles_cursor CURSOR VARYING OUTPUTASSET @titles_cursor = CURSORFORWARD_ONLY STATIC FORSELECT *FROM titles OPEN @titles_cursorGO
CREATE PROCEDURE titles_cursor @titles_cursor CURSOR VARYING OUTPUTASSET @titles_cursor = CURSORFORWARD_ONLY STATIC FORSELECT *FROM titles OPEN @titles_cursorGO
set ret2=***
@EmployeeNo varchar(30)
AS
select top 1 (case Booking_No when is null then Free else Booking_No) ,(case sum(Booking_No) when is null then 0 else sum(Booking_No))
from kb.dbo.bBookingTask
where empl_no = @EmployeeNo and 其它条件你试一下
@EmployeeNo varchar(30)
AS
declare @ret1 int
declare @ret2 intselect Booking_No
from kb.dbo.bBookingTask
where empl_no = @EmployeeNo and 其它条件set @ret1=***
set @ret2=***
select @ret1,@ret2
GO
以下这个通过不了呢,")" 附近有错误
CREATE PROCEDURE P_Get
@EmployeeNo varchar(30)
AS
select top 1 (case Booking_No when is null then Free else Booking_No) ,(case sum(Booking_No) when is null then 0 else sum(Booking_No))
from kb.dbo.bBookingTask
where empl_no = @EmployeeNo and 其它条件
@EmployeeNo varchar(30)
AS
select top 1 (case when Booking_No is null then Free else Booking_No) ,(case when sum(Booking_No) is null then 0 else sum(Booking_No))
from kb.dbo.bBookingTask
where empl_no = @EmployeeNo and 其它条件
@EmployeeNo varchar(30)
ASselect top 1 case when Booking_No is null then Free else Booking_No end ,case when sum(Booking_No) is null then 0 else sum(Booking_No) end
from kb.dbo.bBookingTask
where empl_no = @EmployeeNo --and 其它条件
case when 注意要end 结束
还有 case Booking_No when is null ......
应该这么写 case when Booking_No is null then .......