Wayne Sheffield

My blog about SQL Server

Browsing Posts in SQL

If you can establish a connection to a SQL Server, but are having problems logging in to it, you will get an 18456 error. This error is deliberately obfuscated in SQL Server so that the user can’t tell why the error failed (and thus try to crack into the server). All the user will get [...]

We all have a bucket list – that list of things that we want to accomplish before one, well, kicks the bucket. Perhaps you want to ski the Swiss Alps. Learn a foreign language. Learn to play a musical instrument. Surf the Hawaiian swells. Visit far-away places. Get romanced by a Frenchman in Paris (which [...]

I ran into an interesting problem recently. There is a 4TB database that is log shipped to a DR site, and some new data files needed to be added to the database. Mistake #1: The drive volumes on the DR server are not configured the same as the primary site. Mistake #2: This mismatch was [...]

I’ve been digging deeper into the Ghost Cleanup process recently, and quite naturally my quest lead to Paul Randal’s blog. He has a post about the Ghost Cleanup process in depth, and in this post is this line: The ghost cleanup task will leave a single record on the page to avoid having to deallocate [...]

  Here we are at TSQL Tuesday #37 – the start of the fourth year. Sebastian Meine (@sqlity / blog) is hosting this month’s T-SQL Tuesday blogging party, and he wants us to “write about topics like the good and the bad patterns of joining you have seen out there”. (Sebastian is also running a [...]

 The Myth One misconception that I see a lot deals with how data is stored in a clustered index. Specifically – is the data in a clustered index stored on the page in physical order? Most people will say “Yes”, and they get this from the definition (see BOL: Clustered and Nonclustered Indexes Described), which [...]

The Scenario: You just restored a production database on a development server. You’ve told the developers that it’s restored, and you start to relax in your chair. 30 milli-seconds later, your phone is ringing… the developers can’t connect to the database that you just restored. You check the server, and the login exists. You check [...]

SQL Server 2012 introduces several new date/time functions that allow you to build a date/time from the individual parts of a date/time value. As I was experimenting with them, I was thinking that this is pretty neat, and bound to be very useful. And then I started wondering how well it performed. Before I had [...]

Table-Valued Functions. What a wonderful addition to SQL they make. They take parameters, do some work, and return a result set that can be used in queries. You can select directly against them, or utilize them with the APPLY operator. These are truly versatile additions to SQL -and  since you can pass parameters to them, [...]

One thing that I have seen repeatedly is that (too) many people believe that if you have a clustered index on a table, that you can run a SELECT statement without an ORDER BY clause from that table and the results will be in the order of the clustered index key. Nope, this is absolutely [...]