July 1, 2020 at 4:13 pm
Hi,
How to execute single query on different databases when one of the column missing in one database table.
Ex1:
select a,b,c from test
we are running above query in different databases in Power BI, All the databases have the same schema,but recently
we need to amend the query to
select a,b,c,d from test. But unfortunately in one of the database (out of 10), column d is not implemented in test table, we don't have permission to add new column d in the test table. Now how can I run this query without throwing error.
Thanks
Sangeeth
July 2, 2020 at 5:10 pm
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
July 3, 2020 at 8:20 am
If you can't add columns\objects that can only be done by dynamic SQL. If you can create objects, then you can create view that will have placeholder in some databases and actual data in the needed one.
July 4, 2020 at 1:59 pm
I agree with the notion of a view that dkultasev posted. If these types of changes are infrequent, then manually building one would be fine. If these tables change a lot, then it might be best to write a little dynamic SQL to interrogate the meta-data of the table in the various databases to build the view on demand.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply