2021年3月28日星期日

Merging data from Tables with different schema

for a report we need to merge 2 SQL Server DB Tables of different schemas. I have tried

SELECT ControlRec FROM MercerReportTable UNION SELECT * FROM MercerReportTableMod ORDER BY orderby ASC

but this and JOINs give the following error: All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists.

I assume this means it won't merge because the tables are different.

There must be a way; can anyone please help? I did a search here on merging tables but the posts didn't help me.

Thanks! Mike Kiser

https://stackoverflow.com/questions/66847911/merging-data-from-tables-with-different-schema March 29, 2021 at 10:02AM

没有评论:

发表评论