spAddUpdate_SiteNotes
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@PKID | int | INOUT | |
@ContentID | int | IN | |
@QueryID | int | IN | |
@NoteTopics | ntext | IN |
Definition
Copy
CREATE PROCEDURE dbo.spAddUpdate_SiteNotes
(
@PKID int output,
@ContentID int,
@QueryID int,
@NoteTopics ntext
)
AS
BEGIN
DECLARE @Count int
BEGIN TRANSACTION
SELECT @Count = COUNT(ContentID) FROM SiteNotes WHERE ContentID = @ContentID
IF (@Count = 0)
BEGIN
INSERT INTO SiteNotes
(
ContentID,
QueryID,
NoteTopics
)
VALUES
(
@ContentID,
@QueryID,
@NoteTopics
)
SELECT @PKID = @ContentID
END
ELSE
UPDATE SiteNotes
SET
QueryID = @QueryID,
NoteTopics = @NoteTopics
WHERE ContentID = @PKID
COMMIT TRANSACTION
END