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]My first year in blogging
Posted on January 3, 2012
| 3 minutes
| spaghettidba
WordPress.com prepared a 2011 annual report for this blog and I want to share it with you.
Here’s an excerpt:
A San Francisco cable car holds 60 people. This blog was viewed about 2,900 times in 2011. If it were a cable car, it would take about 48 trips to carry that many people. Click here to see the complete report. This is my first year as a blogger and I’m very happy with it.
[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]RunCore mSata SSD on Dell precision laptops
Posted on October 19, 2011
| 5 minutes
| spaghettidba
What I was planning to write on this post is a total different story from the one you will read here. I was ready to describe in detail how to open the laptop, put the drive in and combine the speed of SSD with the capacity of traditional spin disks on your laptop.
Well, you won’t read anything about that here: despite being advertised as compatible on the product page, this mSata drive won’t work on Dell precision laptops.
[Read More]