|
jassie
Posting Yak Master
114 Posts |
Posted - 06/19/2012 : 23:31:25
|
I have two tables that I am questioning in a sql server 2008 r2 database. The table called [dbo].[AT] is the main table. The table called [dbo].[AT_Pln] can have 1 to 500 rows for every record in the [dbo].[AT].
Can you tell me if the [AT_id] in the [dbo].[AT_Pln] is a foreign key to the [dbo].[AT] table? To me it looks like there is no foreign key setup. The following is the defintion for the two tables: USE [dt1] GO
SET ANSI_NULLS ON GO
SET QUOTED_IDENTIFIER ON GO
SET ANSI_PADDING ON GO CREATE TABLE [dbo].[AT]( ( [AT_Pln_id] [int] IDENTITY(39502,1) NOT FOR REPLICATION NOT NULL, [AT_id] [int] NULL, [Cust] [varchar](50) NULL, CONSTRAINT [PK_AT_Plan] PRIMARY KEY CLUSTERED ( [AT_Plan_id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY] ) ON [PRIMARY]
go
USE [dt1] GO
SET ANSI_NULLS ON GO
SET QUOTED_IDENTIFIER ON GO
SET ANSI_PADDING ON GO
CREATE TABLE [dbo].[AT_Pln]( [AT_id] [int] IDENTITY(1,1) NOT NULL, [Payment_Month_Date] [datetime] NULL, [AT_Received_Date] [datetime] NULL, [Comments] [varchar](4000) NULL CONSTRAINT [PK_AT_ATID] PRIMARY KEY CLUSTERED ( [AT_id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY] ) ON [PRIMARY]
GO
SET ANSI_PADDING OFF GO
ALTER TABLE [dbo].[AT] WITH CHECK ADD CONSTRAINT [FK_AT_AT] FOREIGN KEY([AT_id]) REFERENCES [dbo].[AT] ([AT_id]) GO
ALTER TABLE [dbo].[AT] CHECK CONSTRAINT [FK_AT_AT] GO
|
|