Category: TSQL

Search Argument Case Study: WHERE the year was 2002…

Content Rating: Beginner, Tips It’s entirely possible that you’re fiddling with your search arguments too much, and missing out on the boost a good index gives your query.  Here’s a quick demonstration of the power of a well-thought-out search clause on a date column.  For this example we’ll use AdventureWorks (freely available at Codeplex). Let’s […]

SELECT INTO and IDENTITY (or, BOL is Sorta Wrong)

I am easily distracted.  Lucky for all of us, I tend to be distracted by cool tidbits in SQL Server Books Online. This time, I was arrested by this little nugget: When an existing identity column is selected into a new table, the new column inherits the IDENTITY property, unless one of the following conditions […]

Meme Monday SQLstrology – Table Valued Zodiac Function

It’s Meme Monday time! Our topic is SQL Horoscopes, or more catchily, SQLStrology. We’re going to have to figure out what astrological sign our SQL Server instance has – when it was “born” (installed) – before we can apply any kind of horoscope predictions.  I’ll start with the base query to find the installation date: SELECT […]