太悲剧了。。存储过程 写错了

lijing3333 2011-06-03 08:07:14


CREATE PROCEDURE [dbo].[P_AddUserTask]
(
@award int,
@userId int,
@state int output
)
AS
declare @result int
set @result=(select count(1) from PwdProtection where userId=@userId)
if @result=1
then
set @state=@result
else
@result=0
end
SET NOCOUNT ON;
GO



我这个应该怎么写哇?? 求教 求教
...全文
36 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
东那个升 2011-06-03
  • 打赏
  • 举报
回复
去掉 THEN else 后面加个SET 去掉END
dearbinge 2011-06-03
  • 打赏
  • 举报
回复

CREATE PROCEDURE [dbo].[P_AddUserTask]
(
@award int,
@userId int,
@state int output
)
AS
SET NOCOUNT ON
declare @result int
select @result = count(1) from PwdProtection where userId=@userId
if @result=1
then
set @state=@result
else
@result=0
end
SET NOCOUNT OFF
GO


东那个升 2011-06-03
  • 打赏
  • 举报
回复
CREATE PROCEDURE [dbo].[P_AddUserTask]
(
@award int,
@userId int,
@state int output
)
AS
declare @result int
set @result=(select count(1) from PwdProtection where userId=@userId)
if @result=1

set @state=@result
else
set @result=0
GO


ForFumm 2011-06-03
  • 打赏
  • 举报
回复
楼主想干嘛?

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧