Convert a Trace File from SQLServer 2012 to SQLServer 2008R2
Posted on November 7, 2012
| 4 minutes
| spaghettidba
Recently I started using RML utilities quite a lot.
ReadTrace and Ostress are awesome tools for benchmarking and baselining and many of the features found there have not been fully implemented in SQLServer 2012, though Distributed Replay was a nice addition.
However, as you may have noticed, ReadTrace is just unable to read trace files from SQLServer 2012, so you may get stuck with a trace file you wont’ abe able to process.
[Read More]Replay a T-SQL batch against all databases
Posted on June 27, 2012
| 10 minutes
| spaghettidba
It’s been quite a lot since I last posted on this blog and I apologize with my readers, both of them :-).
Today I would like to share with you a handy script I coded recently during a SQL Server health check. One of the tools I find immensely valuable for conducting a SQL Server assessment is Glenn Berry’s SQL Server Diagnostic Information Queries. The script contains several queries that can help you collect and analyze a whole lot of information about a SQL Server instance and I use it quite a lot.
[Read More]Hide service accounts from Windows logon screen
Posted on April 5, 2012
| 2 minutes
| spaghettidba
If you are playing with multiple Virtual Machines and multiple SQL Server instances and features, it’s very likely that your virtual machines logon screens are showing all the users you set up for service accounts.
In this case, my Master Data Services playground shows the “MDSAppPoolUser” I set up for the MDS web application:
Needless to say that I will never need to logon as one of those service accounts and I would be happier if the logon screen just hid them.
[Read More]SQL Server and Custom Date Formats
Posted on March 23, 2012
| 1 minutes
| spaghettidba
Today SQL Server Central is featuring my article Dealing with custom date formats in T-SQL.
There’s a lot of code on that page and I thought that making it available for download would make it easier to play with.
You can download the code from this page or from the Code Repository.
CustomDateFormat.cs formatDate_Islands_iTVF.sql formatDate_Recursive_iTVF.sql formatDate_scalarUDF.sql parseDate_Islands_iTVF.sql I was also asked to include a performance chart for the different methods included in the article.
[Read More]How to Eat a SQL Elephant in 10 Bites
Posted on March 15, 2012
| 13 minutes
| spaghettidba
One byte at a time, obviously!
No elephants were harmed during photoshopping. Sometimes, when you have to optimize a poor performing query, you may find yourself staring at a huge statement, wondering where to start. Some developers think that a single elephant statement is better than multiple small statements, but this is not always the case.
Let’s try to look from the perspective of software quality:
Efficiency The optimizer will likely come up with a suboptimal plan, giving up early on optimizations and transformations.
[Read More]SQL Server 2012 RTM
Posted on March 6, 2012
| 1 minutes
| spaghettidba
Today Microsoft announced that SQL Server 2012 codename “Denali” has Released To Manufacturing and will be available for download starting from April 1.
April fool’s? I don’t think so. Time will tell.
One thing is sure: each and every bug discovered in this version will be ascribed to that unusual release date. :-)
If you’re a MSDN/TechNet subscriber, you can download them as of March 7. Yes, tomorrow! Keep your fingers ready to push the download button!
[Read More]Mirrored Backups: a useful feature?
Posted on December 29, 2011
| 3 minutes
| spaghettidba
One of the features found in the Enterprise Edition of SQL Server is the ability to take mirrored backups. Basically, taking a mirrored backup means creating additional copies of the backup media (up to three) using a single BACKUP command, eliminating the need to perform the copies with copy or robocopy.
The idea behind is that you can backup to multiple locations and increase the protection level by having additional copies of the backup set.
[Read More]Setting up an e-mail alert for DBCC CHECKDB errors
Posted on November 28, 2011
| 26 minutes
| spaghettidba
Some months ago I posted a script on a SQLServerCentral forum to help a member automating the execution of DBCC CHECKDB and send and e-mail alert in case a consistency error is found.
The original thread can be found here.
I noticed that many people are actually using that script and I also got some useful feedback on the code itself, so I decided to write this post to make an enhanced version available to everyone.
[Read More]Discovering resultset definition of DBCC commands
Posted on November 16, 2011
| 6 minutes
| spaghettidba
Lots of blog posts and discussion threads suggest piping the output of DBCC commands to a table for further processing. That’s a great idea, but, unfortunately, an irritatingly high number of those posts contains an inaccurate table definition for the command output.
The reason behind this widespread inaccuracy is twofold.
On one hand the output of many DBCC commands changed over time and versions of SQL Server, and a table that was the perfect fit for the command in SQL Server 2000 is not perfect any more.
[Read More]Concatenating multiple columns across rows
Posted on October 13, 2011
| 5 minutes
| spaghettidba
Today I ran into an interesting question on the forums at SQLServerCentral and I decided to share the solution I provided, because it was fun to code and, hopefully, useful for some of you.
Many experienced T-SQL coders make use of FOR XML PATH(‘’) to build concatenated strings from multiple rows. It’s a nice technique and pretty simple to use. For instance, if you want to create a list of databases in a single concatenated string, you can run this statement:
[Read More]