请教存储过程写法
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Sp_MySysNotifcation_Select_ById]
@NotificationID int,
@UserID int,
@IsMarkRead int,
@Result int output
AS
BEGIN
SET NOCOUNT ON;
IF @IsMarkRead=0
BEGIN
UPDATE tblMySysNotifications
SET IsMarkRead=1
WHERE NotificationID=@NotificationID
END
SELECT S.Body,S.Subject, C.UserID
FROM dbo.tblMySysNotifications C
INNER JOIN dbo.tblCoreSysNotifications S ON C.NotificationID = S.NotificationID
WHERE C.NotificationID = @NotificationID
END
以上是SP代码,我想在select的时候给@Result赋值,条件是C.UserID=@UserID时@Result=0,否则为1,该怎么写?
拜托大家了,数据库代码不太熟