Reputation: 675
The requirement is simple the execute somewhat troublesome.
I have Azure SQL Database called "MyDB". I want to populate a table in MyDB with DB_ID and DatabaseName with all of the database on the same server.
Now If I use "SELECT name, database_id FROM sys.databases" using master I can get the information I require but I cannot seem to fine a method to do a cross db insert into from master to MyDB. This is a Azure SQL Database not a VM.
Upvotes: 1
Views: 115
Reputation: 2775
You can't do cross database queries from within an Azure SQL Database at this time. So, in order to do what you want, you'd be better off doing it externally using something like Powershell to automate the process.
Upvotes: 3