SQL Azure issue

As most people will probably do, I’m connecting to Azure SQL from SQL Server Management Studio on my virtual PC. Suddenly I noticed the last records were not returned when executing a select statement like:
select * from headers order by syncdatetime desc

Strange enough I get the latest datetime when I run the following query:
select max(syncdatetime) from headers

I still don’t know what the cause of the issue is. Got some warning messages on the MEF cache (whatever that may be) and a recommended update of the Visual Studio extensions. The following post suggests the MEF cache might become corrupted when installing Visual Studio extensions. I didn’t install any extensions myself, but I noticed that I enabled the setting to automatically install Visual Studio extension updates. Link: VisualStudio.com

First of all, when I ran the very same query next day all records were returned again. Huh? I also found a work-around via the Azure Portal. You can go to your SQL database in Azure and look for the Data Explorer in the menu.

After logging in to your database, you will get a screen where you can run your queries. Since you are running the query from Azure now, all records will be returned. Just like a logic app calling the database will get back all results.

Very strange indeed. If you have any suggestions, please let me know.

Connect to SQL Azure database

When creating an SQL Azure database you have to specify a server admin login. You can use this admin account to access SQL Azure via SQL Server Management Studio with the authentication mode set to SQL Server Authentication.

After you create a SQL Azure database, you can access and populate the database via SQL Server Management Studio as you would do with an on prmemise database. The database to connect to has the following format [custom name].database.windows.net. To use SQL Azure from your local machine, you have to add firewall rules. Once again, the place where you can specify the firewall rules is not exactly intuitive. When you select the database, you see a button [Open in Visual Studio]. When you click this button, you get a blade where you can click on link Configure your Firewall. Note that you can also click Show Firewall Settings on the database server property page. You can find your IP adres via whatsmyip.com.

SQL Azure

Other checks you can perform in case of connections issues:

  • Go to the SQL Server Configuration Manager -> SQL Server Network Configuration -> Check if Named Pipes and TCP/IP are enabled.
  • Open Server Manager -> Tools / Windows Firewall and security -> Set outbound connections allowed