|
muzzettemm
Posting Yak Master
212 Posts |
Posted - 2009-08-03 : 20:36:27
|
| Hi guys I had to import a table into sql from Access and it needs to be Joined with another table on sql server. but I am getting a Error. the foreign key is [Parent id] in the table I had to import which is called the Contact_sc How do I deal with this?? How do I alter the table. This is the error message I keep geting[Parent ID] would be the foreign key in the Contact_sc . sorry about that what I was wantig to know is how would I alter the table so that there can be a relationship between the two?? I just imported the table and tried to create a relationship with the foreign key [parent id] to the People_tbls primary key [Parent Id] and I got that error 'People_tbl' table saved successfully'Contact_sc' table- Unable to create relationship 'FK_Contact_sc_People_tbl'. The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_Contact_sc_People_tbl". The conflict occurred in database "SCAIR", table "dbo.People_tbl", column 'Parent ID'.Here are the tablesSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[Contact_sc]( [ID] [int] NOT NULL, [Contact Date] [datetime] NULL, [Parent ID] [nvarchar](50) NULL, [Type of Contact] [nvarchar](50) NULL, [Purpose of Contact] [nvarchar](max) NULL, [Referral Date] [datetime] NULL, [Earned hours] [float] NULL, [Catagory for hours] [nvarchar](255) NULL, [Services Covered] [nvarchar](255) NULL, [State Catagory] [nvarchar](255) NULL, [State Services Covered] [nvarchar](255) NULL, CONSTRAINT [PK_Contact_sc] PRIMARY KEY CLUSTERED ( [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]People_tblSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[People_tbl]( [Parent ID] [nvarchar](50) NOT NULL, [Family ID] [nvarchar](50) NULL, [StudtID] [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, [DOB] [datetime] NULL, [Sex] [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, [ReferralLocation] [nvarchar](50) NULL, [RegistrationDate] [datetime] 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, [SchoolAddress] [nvarchar](50) NULL, [SchoolName] [nvarchar](50) NULL, [SchoolPhone] [nvarchar](50) NULL, [SchoolCity] [nvarchar](50) NULL, [SchoolState] [nvarchar](50) NULL, [SchoolZip] [nvarchar](50) NULL, [TimeSchoolStart] [datetime] NULL, [TimeSchoolEnds] [datetime] NULL, [StudentGPA] [nvarchar](50) NULL, [Grade] [nvarchar](50) NULL, [Age] [nvarchar](50) NULL, [StudentschoolID] [nvarchar](50) NULL, [SchoolID] [nvarchar](50) NULL, [StudentRelease] [nvarchar](50) NULL, [ParentRelease] [nvarchar](50) NULL, [DateOfRelease] [datetime] NULL, [TanfReferral] [nvarchar](50) NULL, CONSTRAINT [PK_Parent] 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] |
|