USE [Elyse_DB] GO /****** Object: Table [people].[duty_function_sid_links] Script Date: Fri 02-10-2026 8:29:34 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [people].[duty_function_sid_links]( [function_id] [bigint] NOT NULL, [sid_id] [bigint] NOT NULL, [created] [datetime2](7) NOT NULL, [granted_by] [nvarchar](128) NOT NULL, [valid_from] [datetime2](7) NULL, [valid_until] [datetime2](7) NULL, [notes] [nvarchar](1000) NULL, [app_reference] [nvarchar](1000) NULL, CONSTRAINT [PK_user_function_links] PRIMARY KEY CLUSTERED ( [function_id] ASC, [sid_id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO ALTER TABLE [people].[duty_function_sid_links] ADD CONSTRAINT [DF_duty_function_sid_links_created] DEFAULT (sysdatetime()) FOR [created] GO ALTER TABLE [people].[duty_function_sid_links] ADD CONSTRAINT [DF_duty_function_sid_links_granted_by] DEFAULT (original_login()) FOR [granted_by] GO ALTER TABLE [people].[duty_function_sid_links] WITH CHECK ADD CONSTRAINT [FK_sid_link_to_user_function] FOREIGN KEY([sid_id]) REFERENCES [user_restr].[sid_list] ([sid_id]) GO ALTER TABLE [people].[duty_function_sid_links] CHECK CONSTRAINT [FK_sid_link_to_user_function] GO ALTER TABLE [people].[duty_function_sid_links] WITH CHECK ADD CONSTRAINT [FK_user_function_link_to_sid] FOREIGN KEY([function_id]) REFERENCES [people].[duty_functions] ([function_id]) GO ALTER TABLE [people].[duty_function_sid_links] CHECK CONSTRAINT [FK_user_function_link_to_sid] GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Links duty functions to SIDs. COPYRIGHT NOTICE This database schema and stored procedures are protected by copyright. Copyright. Silkwood Software Pty. Ltd. 2023' , @level0type=N'SCHEMA',@level0name=N'people', @level1type=N'TABLE',@level1name=N'duty_function_sid_links' GO