Friday, June 24, 2022

List of District SQL Server Create Table

 CREATE TABLE [dbo].[MST_DISTRICT](

[District_Id] [int] NOT NULL,

[District_Name] [varchar](50) NULL,

[District_Code] [varchar](50) NULL,

[District_Status] [bit] NULL,

[State_id] [int] NULL,

 CONSTRAINT [PK_DISTRICT_MST] PRIMARY KEY CLUSTERED 

(

[District_Id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

GO


ALTER TABLE [dbo].[MST_DISTRICT] ADD  CONSTRAINT [DF_DISTRICT_MST_District_Status]  DEFAULT ((1)) FOR [District_Status]

GO


ALTER TABLE [dbo].[MST_DISTRICT]  WITH CHECK ADD  CONSTRAINT [FK_MST_DISTRICT_MST_STATE] FOREIGN KEY([State_id])

REFERENCES [dbo].[MST_STATE] ([State_id])

GO


ALTER TABLE [dbo].[MST_DISTRICT] CHECK CONSTRAINT [FK_MST_DISTRICT_MST_STATE]

GO



No comments:

Post a Comment