Skip to content

Instantly share code, notes, and snippets.

@cathode
Created May 18, 2016 20:31
Show Gist options
  • Select an option

  • Save cathode/cc54415f7ffb27480d12cfa25f3cb2e5 to your computer and use it in GitHub Desktop.

Select an option

Save cathode/cc54415f7ffb27480d12cfa25f3cb2e5 to your computer and use it in GitHub Desktop.
CREATE TABLE [dbo].[SessionParameters]
(
[SessionId] SMALLINT NOT NULL,
[PKey] NVARCHAR(128) NOT NULL,
[PValue] NVARCHAR(MAX) NULL,
CONSTRAINT [PK_SessionParameters] PRIMARY KEY ([SessionId], [PKey])
)
GO
CREATE VIEW [dbo].[UserSessionParameters]
AS SELECT
[PKey],
[PValue]
FROM [SessionParameters]
WHERE [SessionParameters].[SessionId] = @@SPID
GO
INSERT INTO [dbo].[UserSessionParameters] VALUES ('LogonTime', GETDATE())
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment