Showing posts with label relationship. Show all posts
Showing posts with label relationship. Show all posts

Sunday, March 11, 2012

Compare Differences 2 Fields

I have an Id# as a PK in one table and I am trying to create a FK relationship on another table I need to compare the data because the new FK table has a few Id#'s that don't match up what is the best way to do this?-- this will list the ID in onetable but not in anothertable
select *
from onetable o left join anothertable a
on o.id = a.id
where a.id is null

do you have the other case ? ID in anothertable but not in onetable ?|||

Maybe something like:

select id#
from newTable a
where not exists
( select id#
from firstTable b
where a.id# = b.id#
)

Friday, February 10, 2012

Come on...Somebody help with Relationship two Databases

Relationship Databases
Hi,
I have a DataBase called "ServerInformation" where theres a table called "Clients"

Another database aplication "Index2003" using the same SQL Server, will acess the information in the table "Clients" from then "ServerInformation" Database.

My question is... How can I ensure data integrity using a relationship that "cascade update related Fields" from two different databases in the field "ID_Client" when its equal fields in :

Index2003 - > Documents - > ID_Clients
ServerInformation - > Clients - > ID_Clients

How can I do the relationship of two tables in different databases?

Thanks for attetion

Leonardo Almeida
Recife - PE - Brazil
55-81-9152-5106You would have to do this via triggers, or by making all data changes through stored procedures that maintain relational integrity.

blindman