spAddUpdate_SiteCodeTableEntries

Parameters

Parameter Parameter Type Mode Description
@EntryGuid uniqueidentifier INOUT
@CodeTablesID int IN
@Description ntext IN
@bUpdate bit IN

Definition

Copy


            CREATE   PROCEDURE [dbo].[spAddUpdate_SiteCodeTableEntries]
            (
                @EntryGuid        uniqueidentifier output,
                @CodeTablesID    int,
                @Description    ntext,
                @bUpdate        bit
            )
            AS
            set nocount on
            if (@bUpdate=0)    
                -- add a new table entry; @Description is a string
                begin
                    DECLARE @MyGUID AS uniqueidentifier
                    SET @MyGUID = newid()

                    INSERT INTO [dbo].[SiteCodeTableEntries]
                    (    
                        [CodeTablesID], 
                        [Description],
                        [EntryGUID]
                    ) 
                    VALUES 
                    (    
                        @CodeTablesID,        
                        @Description,
                        @MyGUID
                    )

                    SELECT @MyGUID
                end
            else
                begin
                    -- update one table entry; @Description is a string
                    UPDATE [dbo].[SiteCodeTableEntries] 
                    SET Description = @Description
                    WHERE EntryGUID = @EntryGuid and CodeTablesID = @CodeTablesID
                end