|
muzzettemm
Posting Yak Master
212 Posts |
Posted - 2009-08-09 : 02:38:30
|
| I have a table called the Parent_ind. Now in the table can be a parent and parent can be a student, and then children can also be students too. How do I create a child table that will help me indicate if a parent and child are related to one another??this is what I have so farthe relationship table SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[Relationship_tbl]([FamilyID] [nvarchar](50) NULL,[Parent ID] [nvarchar](50) NULL,[Student ID] [nvarchar](50) NULL,[RelationshipID] [int] IDENTITY(1,1) NOT NULL,[TypeofRelationship] [nvarchar](50) NULL,[Description] [nvarchar](50) NULL,CONSTRAINT [PK_Relationship_tbl] PRIMARY KEY CLUSTERED ([RelationshipID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GOALTER TABLE [dbo].[Relationship_tbl] WITH NOCHECK ADD CONSTRAINT [FK_Relationship_tbl_Parent_ind] FOREIGN KEY([Parent ID])REFERENCES [dbo].[Parent_ind] ([Parent ID])GOALTER TABLE [dbo].[Relationship_tbl] CHECK CONSTRAINT [FK_Relationship_tbl_Parent_ind] and the Parent_ind tableCREATE TABLE [dbo].[Parent_ind]([Parent ID] [nvarchar](50) NOT NULL,[StudentID] [nvarchar](50) NULL,[Family ID] [nvarchar](50) NULL,[Date of Referral] [nvarchar](50) NULL,[Parent First Name] [nvarchar](50) NULL,[Parent Last Name] [nvarchar](50) NULL,[Parent SS#] [nvarchar](50) NULL,[Telephone #] [nvarchar](50) NULL,[Message #] [nvarchar](50) NULL,[Address] [nvarchar](50) NULL,[City] [nvarchar](50) NULL,[State] [nvarchar](50) NULL,[Zip] [nvarchar](50) NULL,[E Mail Address] [nvarchar](50) NULL,[Tribal Affiliation] [nvarchar](50) NULL,[Event ID] [nvarchar](50) NULL,[TANF staff making Referral] [nvarchar](50) NULL,[Type Participant] [nvarchar](50) NULL,[Required hours] [int] NULL,[Special Instrution] [nvarchar](max) NULL,[GED] [bit] NULL,[High School Diploma] [bit] NULL,[Drivers License] [bit] NULL,[Assessement Date] [bit] NULL,[Assessement] [datetime] NULL,[Career Assessment Date] [bit] NULL,[Career Assessment] [datetime] NULL,[Other] [bit] NULL,[Explain Other] [nvarchar](50) NULL,[GED/High School Diploma-VC Adult School] [nvarchar](50) NULL,[Higher Education] [nvarchar](50) NULL,[Culture] [nvarchar](50) NULL,[Community Service] [nvarchar](50) NULL,[Vocational] [nvarchar](50) NULL,[DMV] [nvarchar](50) NULL,[RegistrationDate] [datetime] NULL,[Grade] [nvarchar](50) NULL,[Age] [nvarchar](50) NULL,[DOB] [datetime] NULL,[____] [nvarchar](50) NULL,[SchoolName] [nvarchar](50) NULL,[SchoolAddress] [nvarchar](50) NULL,[SchoolPhone] [nvarchar](50) NULL,[SchoolCity] [nvarchar](50) NULL,[SchoolState] [nvarchar](50) NULL,[SchoolZip] [nvarchar](50) NULL,[TimeSchoolStarts] [datetime] NULL,[TimeSchoolEnds] [datetime] NULL,[StudentGPA] [nvarchar](50) NULL,[TanfReferral] [nvarchar](50) NULL,[RefereaLocation] [nvarchar](50) NULL,[ScannedDocuments] [ntext] NULL CONSTRAINT [DF_Parent_ind_ScannedDocuments] DEFAULT (N'ScannedDocuments'),CONSTRAINT [PK_Parent_ind] PRIMARY KEY CLUSTERED ([Parent 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] TEXTIMAGE_ON [PRIMARY]GO |
|