0

Is there a simple way to code in c# to get the list of Sql Azure databases in a Windows Azure server?

Thanks Martin

Martin
  • 1,001
  • 3
  • 13
  • 17
  • Just in case you're interested, you can do this action from PowerShell fairly easily - I just documented how in [this answer](http://stackoverflow.com/a/17585877/272109). – David Makogon Jul 11 '13 at 05:57

1 Answers1

2

To list databases on a server, you can query the sys.databases table in the master database. You can use any data access framework you like to query this table, such as Entity Framework (http://msdn.microsoft.com/en-us/library/bb399572.aspx).

You can also list all servers under your subscription using the Management API (http://msdn.microsoft.com/en-us/library/windowsazure/gg715269).

Ming Xu - MSFT
  • 2,116
  • 1
  • 11
  • 13
  • Thanks. However the only tables that I see in the master database are sysdac_history_internal and sysdac_instances_internal. Am I looking in the right place? – Martin Jun 07 '12 at 12:38
  • Sorry, I meant sys.databases view (not table). Try "SELECT * FROM sys.databases" in SQL Server Management Studio. It should work. You can refer to http://msdn.microsoft.com/en-us/library/windowsazure/ff951625.aspx for more information. – Ming Xu - MSFT Jun 08 '12 at 07:18