execute sql task
i have two tables is there. 1. first table 2. table ID- PRIMARY KEY UID- PRIMARY KEY mapetd to first table Group id GROUP ID- FORIGEN KEY i deleted primary key and forieng key Using execute sql task. again i created primary key and foriegn key. i got the bellow error. [Execute SQL Task] Error: Executing the query ALTER TABLE [dbo].[first table.. ." failed with the following error: "The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK__tblGroupL__Group__4402926E". The conflict occurred in database "Leap", table "SECONDTABLE", column 'UID'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. I AM USING BELLOW query ALTER TABLE [dbo].[fIRST tABLE] WITH CHECK ADD CONSTRAINT [FK__tblGroupL__Group__4402926E] FOREIGN KEY([GID]) REFERENCES [dbo].[SECONDTABLE] ([UID]) GO
May 9th, 2011 6:44am

1)Try creating the constraint with a different name like : ALTER TABLE [dbo].[fIRST tABLE] ADD CONSTRAINT [FK_tblGroup] FOREIGN KEY([GID]) REFERENCES [dbo].[SECONDTABLE] ([UID]) GO Happy to help! Thanks. Regards and good Wishes, Deepak.
Free Windows Admin Tool Kit Click here and download it now
May 9th, 2011 6:59am

i tryied but i getting same error
May 9th, 2011 7:08am

Run the below query to check for the values available in the first table not available on the second table SELECT Groupid from Firsttables EXCEPT SELECT Uid from secondtable. If you get any records , delete those ids from firsttable and try creating this constraints again.
Free Windows Admin Tool Kit Click here and download it now
May 9th, 2011 8:03am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics