Friday, June 30, 2023

Example of Configuration table in SQL Server

Following is an example of configuration table in T-SQL which can be used for configuring the paramter(s) and providing the values from this table. Parameter can be text, integer or date type, we have separate column for parameter values with respect to their data type

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Configuration] (
	[Parameter_ID] [int] NOT NULL
	,[Parameter_Name] [varchar](35) NOT NULL
	,[Parameter_Date] [datetime] NULL
	,[Parameter_Number] [float] NULL
	,[Parameter_Text] [varchar](255) NULL
	,[Active] [bit] NOT NULL
	,[CreateUser] [varchar](50) NOT NULL
	,[CreateDate] [datetime] NOT NULL
	,[ModifyUser] [varchar](50) NOT NULL
	,[ModifyDate] [datetime] NOT NULL
	,CONSTRAINT [PK_dbo_Configuration] PRIMARY KEY CLUSTERED ([Parameter_ID] ASC) WITH (
		PAD_INDEX = OFF
		,STATISTICS_NORECOMPUTE = OFF
		,IGNORE_DUP_KEY = OFF
		,ALLOW_ROW_LOCKS = ON
		,ALLOW_PAGE_LOCKS = ON
		) ON [PRIMARY]
	) ON [PRIMARY]
GO

SET ANSI_PADDING ON
GO

No comments:

Post a Comment