Kunal Gupta

Kunal Gupta

  • NA
  • 149
  • 6.7k

sql database query

Aug 5 2016 6:05 AM
Two tables are there
 
 
CREATE TABLE [dbo].[Status_Master_Table]
(
[StatusId] INT IDENTITY (1, 1) NOT NULL,

[Status_Description] NVARCHAR (50) NOT NULL,

[Remarks] VARCHAR (50) NOT NULL,

PRIMARY KEY CLUSTERED ([StatusId] ASC)
); 
 
second table is
 
CREATE TABLE [dbo].[Lab_Master_Table]
(
[Lab_Id] INT IDENTITY (1, 1) NOT NULL,

[Lab_Name] NVARCHAR (50) NOT NULL,
 
[Status] NVARCHAR (50) NOT NULL,

PRIMARY KEY CLUSTERED ([Lab_Id] ASC),

UNIQUE NONCLUSTERED ([Lab_Name] ASC)

); 
 
what is the syntax to set[StatusId] of first table as a foreign key to second table
 

Answers (3)