Time normalization: a SQL CLR approach to address unevenly-spaced data samples

One very common challenge in the IT department is to represent time driven data. Think about performance counter values, weather data or, more simply, your own weight tracking. This kind of data is taken in samples: each sample is defined by the collection time. When we try to visualize the data, we often need to…


SQL Server 2014 and Windows Azure Blob Storage Service: Better Together

Just a quick post to point you to this new SQL Server 2014 whitepaper: SQL Server 2014 and Windows Azure Blob Storage Service: Better Together. You will find many interesting best practices and a WSFC-like framework. Summary: SQL Server 2014 introduces significant new features toward a deeper integration with Microsoft Azure, thus unlocking new scenarios and…


SQL Server 2014 Dynamic-link library load

Have you ever wondered how SQL Server 2014 accomplishes the “Native compilation” feature? In this post I’ll show you how to inspect what SQL Server is doing behind the scenes while “compiling” your native code. This will be a deep post that will require a non production instance since we will restart it many times….


Streaming in SQL Server using SQL CLR

The SQL Server engine execution operators are of two kinds: blocking and non-blocking. Blocking operators need to consume the complete dataset before returning an output. Think about the COUNT(*) operator: in order to tell you the result it has to go over all your rows. Another example of blocking operator is the Sort operator. Proper…


SQL Server To Windows Azure helper library – A SQL Server open source CodePlex project

Hi all, since my last SQLRally presentation in Amsterdam people kept asking for a working build of the SQLCLR Windows Azure REST API  DLL. Many snippets of it can be found in this blog; however most of you don’t really care about the implementation boilerplate. On the contrary, some of you might actually like to…


Blob leases: how to break them from SQL Server (using SQL CLR and Windows Azure REST API)

SQL 2014 will give you a terrific feature: SQL XI. It will allow you to store your datafiles and tlogs directly in Windows Azure Page Blobs. You can read about it in this great post: http://blogs.msdn.com/b/igorpag/archive/2013/10/23/create-a-sql-server-2014-database-directly-on-azure-blob-storage-with-sqlxi.aspx. As you can see, however, SQL Server places a lease on each blob in use. Think about Azure leases…


SQLCLR: string or SqlString?

One of the most asked question regarding the SQL CRL is whether to use string instead of System.Data.SqlString (see [MSDN] SqlString Structure for further details). You might guess that, from a performance point of view, using string is better. Let’s confirm (or reject) this assumption. First we need to create two very simple SQLCLR functions:…


SQL CLR Functions and parallelelism

If you develop your own SQLCLR functions, you know you should decorate the method with this attribute class: [MSDN] SqlFunctionAttribute Class. You might wonder what these options will do. The DataAccess Property, according to the documentation, “Indicates whether the function involves access to user data stored in the local instance of SQL Server”.  You might be…


Call Copy Blob (Azure REST API) from SQL Server

Following my recent post Call Azure REST API from SQL Server I’ve received many requests about how to call the new API Copy Blob. Its description is here: http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx. As before, let me show you what we want to achieve:   We want to have a simple stored procedure to call with a storage account, a source…


Call Azure REST API from SQL Server

Microsoft Azure platform can be managed in a number of ways. You can use PowerShell, you can use the Management Portal or you can use the http REST interface. If you happen to manage a lot of Azure items (containers, blobs, etc…) you might have to do some serious PowerShelling. But would not be wonderful…