Removing All SQL Server Query Store Data

Azure, SQL Server 2016
While setting up example code for my presentation at SQL Cruise (which is going to be a fantastic event), I realized I wanted to purge all the data from my Query Store, just for testing. I did a series of searches to try to track down the information and it just wasn't there. So, I did what anyone who can phrase a question in less than 140 characters should do, I posted a question to Twitter using the #sqlhelp hash tag. Jamey Johnston (t|b) came through... and it was right there in the documentation that I had been reading, over and over. In fact, it was in the documentation in two different places. Reading is clearly a problem for me today. Just so that you know, it's actually really easy:…
Read More

“Applies To…” in the MSDN Documentation

Azure, SQL Server 2016, T-SQL
Quick little post. I just wanted to share how happy I am with the new "THIS TOPIC APPLIES TO" infographic. An example here: I think it makes things much more clear when you're attempting to figure out what's up with some T-SQL syntax. Well done Microsoft and thank you. Side note, this only exists in documentation that has been updated recently. I first saw it in some documentation that was updated January 11, 2016. It's not there in another piece of documentation I saw that was updated October 15, 2015. Here's hoping it gets put everywhere. It works.
Read More

Restoring a Database in Azure

Azure
One of the many small things you don't have to worry about any more when working with Azure SQL Database are those pesky backups... Ha-ha-ha! Yeah, I can't keep a straight face when I type it. Microsoft takes on the role of DBA and creates backups and log backups for you when you're working in the Platform as a Service offering of Azure SQL Database. If that doesn't scare you, I'm not sure what will. However, there's good news. There are still ways for you to create your own backup (through the bacpac, I outlined it here, years ago). More good news is, Microsoft's backups actually work. Testing it out is easy. Let's walk through it once. I'm going to assume you have an Azure account on which you already…
Read More

Changing Course On Learning

Azure, Database Lifecycle Management, DevOps, DocumentDB, Professional Development
With all the new stuff on the Microsoft Data Platform, it's really hard to keep up with it all. I had announced my plans to charge down the DocumentDB road to try to get the basics of that in my head along with learning some JSON so I could get what all the hoopla is about. However, after a lot of thought and some extensive meetings at Redgate, I'm looking to shift my learning in a new direction. First up. Arrrrrrrrr! No, it's not yet "Talk Like a Pirate Day." I'm going to start learning the R language. It's a language for statistical computing and is one of the many underpinnings for what's going to be happening with a lot of the Machine Learning capabilities in the Data Platform. With Azure…
Read More

Trace Flags in Azure SQL Database

Azure, SQL Server 2016, T-SQL
One of the ways that you take more direct control over your SQL Server instances is through the use of trace flags. There are a number that people recommend you enable by default. Prior to Extended Events for example, I'd say you should turn on trace flag 1222 in order to capture deadlock information on your server (now I just recommend you use the system_health session). I absolutely think you should turn on trace flag 2371 to get better behavior out of your automated statistics updates. There are others that I'll leave to all the systems experts to advise you on. What about Azure SQL Database? I doubt you'll be shocked, but if I try this: DBCC TRACEON (2371,-1); I get the following error: Msg 2571, Level 14, State 3,…
Read More

Azure SQL Database v12 and SQL Magazine

Azure
I spend many of my evenings researching and writing. Sometimes it's writing new books. Sometimes it's fixing and rewriting old books. Occasionally it's a blog post like this one. Lately, it's been a series of articles for SQL Magazine that are all about the new functionality available in Azure SQL Database v12 that was released in February for most data centers in Azure. It's a whole new ball game. Check out my introductory article for v12 and the one on DMVs in Azure. I have more coming up on CLR in Azure, getting started, PowerShell, DBCC, T-SQL enhancements, Premium Tier and more. I'll also get into "old" functionality like backup and restore. I'll also explore new functionality, Azure is nothing if not dynamic, as becomes widely available. I know a…
Read More

Azure SQL Database Firewall Settings

Azure
The new portal for managing Azure is pretty. I'm not sure I'm in love with it, but it's pretty. However, one thing that I have to access regularly is the firewall settings for my Azure SQL Database. I do demos from all over the place. I never know what my IP address is going to be. Rather than expose everything, I just set up whatever IP address I'm on and then remove it later. The old portal made this easy. The new one... not so much. So, let's get this down real quick. Assuming you connect to the new portal and go straight to your database, you'll see this image showing you the database and the server it's on: You won't see anything else that suggests FIREWALL. But, you can…
Read More

Error: Unknown Property ismemoryoptimized

Azure
If you're starting the process of moving your databases in Azure SQL Databast to v12, you need to do one thing. Make sure you have SQL Server 2014 CU5 or better installed on your machine with Management Studio (current list of updates). Otherwise, like me, you'll be looking at the above error. Just a quick blog post to help out. I saw this error, did a search, and didn't hit a single entry telling me what to do. I started the install of CU6 (I needed to catch up on cumulative updates anyway). While that was happening, I went to Twitter and posted to #sqlhelp to see if anyone else had hit this. I got a response from Amit Banarjee pointing me to this MSDB blog on the topic, reinforcing…
Read More

Execution Plans in Azure SQL Database

Azure
Microsoft has stated pretty clearly that they're putting code on Azure first, ahead of the desktop. Which makes one wonder when we're going to start to see some of this cool stuff within SSMS. What cool stuff you ask? Well, let me explain. Let's start with a query: SELECT m.MovieName, msd.MovieStageName, st.StageTypeDesc FROM dbo.Movie AS m JOIN dbo.MovieStage AS ms ON m.MovieId = ms.MovieID JOIN dbo.MovieStageDefinition AS msd ON ms.MovieStageDefinitionId = msd.MovieStageDefinitionId JOIN dbo.StageType AS st ON msd.StageTypeId = st.StageTypeId WHERE m.MovieId = 42; When I run this on Windows Azure SQL Database (WASD) I get the following execution plan: Kind of weird, kind of useful, right? First thing new that I can do is zoom in using that slider bar you seen in the lower left and then graphical…
Read More

Azure SQL Database Execution Plan Differences

Azure, T-SQL
I've been exploring execution plans in Azure SQL Databases a lot lately. I'm getting a presentation together for  some upcoming SQL Saturday events (first one is SQL Saturday #177, Silicon Valley). If you scroll to the bottom of this previous post, I mentioned that there were clearly differences in the optimizer because queries against empty databases were generating different plans. I've loaded up the data in my database, both SQL Server and SQL Database, so I can compare real behaviors. Doing so, I found a fun difference, even though I was running the query and generating the plan from SQL Server Management Studio. Here's the property sheet from the SELECT operator for the query run against SQL Server: And here's the property sheet from the SELECT operator for the query…
Read More