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…


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…


SQLSaturday 264 slide deck

Hi all, here are the slides of our recent speech at SQLSaturday 264 in Ancona (http://www.sqlsaturday.com/264/eventhome.aspx). You will also find the demo scripts. Feel free to share your thoughts. Happy Coding, Francesco Cogno (@MindFlavor) and Giuseppe Zagarrio (@ZagaMimmo) [View:~/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-87-37/6-degrees-of-separation.pdf:550:0] [View:~/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-87-37/6254.Demos.zip:550:0]


About Container Shared Access Signature for SQL Server XI

Hi all, Ever since the MSDN post about SQL Server XI, available from SQL 2014 (see  http://blogs.msdn.com/b/igorpag/archive/2013/10/23/create-a-sql-server-2014-database-directly-on-azure-blob-storage-with-sqlxi.aspx) there is a lot of buzz about Azure Storage in the SQL Server community. One recurring question is: What is the Shared Access Signature (SAS) and why SQL Server XI needs it? First some background: in the Azure…


Backup to Azure using TSQL (and CLR)

Hi All, as a sample of how to use Microsoft SQL Server To Windows Azure helper library let me show you how to perform a backup to azure using the TSQL. As prerequisite, of course, you should have downloaded and installed the helper assembly (for how to do that please refer to the project documentation). …


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…


Sneak peek on SQL 2014: Parallel SELECT … INTO!

We are all exited about SQL 2014. I’m sure you have already downloaded the CTP. In this short post I would like to show you a welcome feature that you might not know about :). Suppose to have a large, parallel query. Until now if you wanted to create a table out of that query…