SQL Azure - How to select a sysdatabases table from a primary database in SQL Azure?

In SQL Azure, I try:

select * From master.dbo.sysdatabases files

And get this error:

Link to database and / or server name in 'master.dbo.sysdatabases' is not supported in this version of SQL Server

What to do to be able to run this query in SQL Azure?

+7
source share
2 answers

You use the sys.databases system view (without a master qualification, it is not needed)

The sysdatabases system table is deprecated because SQL Server 2005 (Azure is a later version) is not supported on Azure anyway

+7
source

You get this error because you are using this operator from a database other than the wizard. You cannot add a master. to your statements if you are not already in the main database. More generally, you cannot issue instructions that execute a command in a different database than the one you are on.

You can run the instruction without qualifying the database, and it will be launched, as gbn suggests. Or you can connect to master and execute it as is.

-one
source

All Articles