DataCompare with a WHERE to only get FK rows of lower tables

Compares and synchronizes SQL database content.

Moderators: Chris Auckland, David Atkinson, richardjm, david connell

DataCompare with a WHERE to only get FK rows of lower tables

Postby ccupp@petroweb.com » Fri Jul 15, 2011 5:13 pm

I have a database w/ about 20 tables.

There is one table that is basically at the top of the Pyramid.

I want to do a SQL DataCompare where I only get FK rows in child tables..

Lets Assume A is Top Table and B is Child Table.

I have 10 rows in Table A and 100 in Table B.

Right now when I do a Where a.rowid = 1, my script still returns all rows in Table B. I only want to get the 10 rows in TableB with a FKID of 1.

I have tried unchecking "Disable Foreign Keys" in the Options Tab, but that didn't seem to help
ccupp@petroweb.com
 
Posts: 3
Joined: Thu May 05, 2011 4:00 pm

Postby Chris Auckland » Mon Jul 18, 2011 1:41 pm

Thanks for your post.

It sounds like you need to put the where clause on table b. e.g.

b.FKID = 1
Chris
Chris Auckland
 
Posts: 757
Joined: Tue Oct 24, 2006 2:12 pm
Location: Red Gate Software Ltd.

Postby ccupp@petroweb.com » Mon Jul 18, 2011 3:36 pm

Yes, I could do that.. but with 20 tables.. keeping track of 20 Guids is exactly what I was trying to avoid.. If I have to keep track of all 20 Guids.. then I might as well just go through each table and restrict them by hand instead of using a where clause... but i was hoping to avoid that, as I tend to make errors when I copy and paste all those GUIDs around. :)

casey
ccupp@petroweb.com
 
Posts: 3
Joined: Thu May 05, 2011 4:00 pm


Return to SQL Data Compare Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests