Stored Procedure Properties
Name | Value |
---|---|
Owner | dbo |
Created | 2004-05-31 |
Startup | False |
Encrypted | False |
Creation Options
Name | Value |
---|---|
QUOTED_IDENTIFIER | ON |
ANSI_NULLS | ON |
Parameters
Name | DataType | Length | Type |
---|---|---|---|
@UserId | char | 36 | INPUT |
Total: 1 parameter(s)
SQL
SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE PROCEDURE forums_TrackAnonymousUsers ( @UserId char(36) ) AS BEGIN -- Does the user already exist? IF EXISTS (SELECT UserId FROM AnonymousUsers WHERE UserId = @UserId) UPDATE AnonymousUsers SET LastLogin = GetDate() WHERE UserId = @UserId ELSE INSERT INTO AnonymousUsers (UserID) VALUES (@UserId) -- Anonymous users also pay tax to clean up table DELETE AnonymousUsers WHERE LastLogin < DateAdd(minute, -20, GetDate()) END GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO