Storing the connectionID

  • Hi,

    I need to store the connectionIDs in a table. I want to fire a proc from within a trigger, but I don't know how to return the connectionID, can anyone help?

    This is the proc so far:

    CREATE PROCEDURE dbo.uspCurrentUserUpdate

    @UserName VARCHAR(20),

    @SecurityToken INTEGER

    AS

    IF EXISTS(

    SELECT 1 FROM CurrentUsers CU

    WHERE CU.UserName = @UserName AND CU.SecurityToken = @SecurityToken)

    UPDATE CurrentUsers

    SET ConnectionID = 1

    ELSE

    INSERT INTO CurrentUsers

    (UserName,

    SecurityToken,

    ConnectionID)

    VALUES

    (@UserName,

    @Securitytoken,

    ???????)

  • Try @@spid.

    Andy

  • Thanks!!

  • No problem!

    Andy

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply