我收到错误原因?
ALTER PROCEDURE dbo.verifGuids
@value char(36),
@message char(1)Output
AS
Begin
select value FROM guids WHERE @value=value;
If @value=value
BEGIN
DELETE value FROM guids WHERE @value=value ;
SET @message = 0
END
Else
BEGIN
Set @message = 1
END
Return @message
END
谢谢
答案 0 :(得分:1)
请您按以下方式尝试:
ALTER PROCEDURE dbo.verifGuids
@value char(36),
@message char(1)Output
AS
Begin
DECLARE @SelectValue char(36)
select @SelectValue = value FROM guids WHERE @value=value;
If @value=@SelectValue
BEGIN
DELETE value FROM guids WHERE @value=value ;
SET @message = 0
END
Else
BEGIN
Set @message = 1
END
Return @message
END
答案 1 :(得分:0)
您没有将要查询的数据库值分配给变量进行比较。您还在删除时指定列。尝试这样的事情:
DELETE FROM guids WHERE value=@value;
IF @@ROWCOUNT > 0
BEGIN
SET @message = 0
END
ELSE
BEGIN
SET @message = 1
END