I'm working on a query that will be comparing columns in tables in 2 seperate databases. If the where clause is met, I need to create a log file and then email it at the end of the procedure.
here is my query:
SELECT db1.*, db2.*
FROM db1..ORGANIZATION db1
ON db1.ORG_ID = db2.ORG_ID
where db1.TITLE <> db2.TITLE
db1.CODE <> db2.CODE
db1.ACTIVE <> db2.ACTIVE
if any of the criteria in the where clause is met, I need to create a log file and email it. I'd like to this is using SSIS, however, how can I have a return value of [true] returned in the where statement if something meant, plus the values?
so for example
if db1.organization <> db2.orgranization, I want the values from both databases, return true so I can create a log file, like I mentioned I'd like to do this using SSIS, but if I can't I'll be doing this in a stored procedure that will be kicked off nightly
Am I even going down the right direction with comparing values in the tables?