0

当传递的参数是这样的某个值时,我试图在我的存储过程中设置变量:

ALTER PROCEDURE [dbo].[Procedure1]
(
    @ID int,
    @WatchType varchar(100)
)
AS
    SET NOCOUNT ON
    DECLARE @stock int
    DECLARE @price float
    DECLARE @details varchar(max)

CASE @WatchType
WHEN 'TIMEX' THEN
    (SELECT @stock= Stock, 
    @price= Price, 
    @details= Details, 
    FROM tblWatches WHERE Uid= @ID)
ELSE
END

当我尝试解析它时,我不断收到错误。有谁知道为什么?

4

1 回答 1

0
ALTER PROCEDURE [dbo].[Procedure1]
(
    @ID int,
    @WatchType varchar(100)
)
AS
    SET NOCOUNT ON
    DECLARE @stock int
    DECLARE @price float
    DECLARE @details varchar(max)

IF @WatchType = 'TIMEX'
BEGIN
    (SELECT @stock= Stock, 
    @price= Price, 
    @details= Details, 
    FROM tblWatches WHERE Uid = @ID)
END
于 2012-05-17T20:43:12.577 回答