spAddUpdate_GenericData
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@PKID | int | INOUT | |
@Key | nvarchar(510) | IN | |
@Value | ntext | IN |
Definition
Copy
CREATE PROCEDURE dbo.spAddUpdate_GenericData
(
@PKID int output ,
@Key nvarchar(510) ,
@Value ntext
)
AS
SELECT @PKID = ISNULL((SELECT [ID] FROM GenericData WHERE [Key] = @Key),0)
begin transaction
if (@PKID<1)
begin
INSERT INTO GenericData
(
[Key] ,
[Value]
)
VALUES
(
@Key ,
@Value
)
SELECT @PKID = @@Identity
end
else
begin
UPDATE GenericData SET
[Value] =@Value
WHERE ID=@PKID
end
commit transaction