Category: Tech and Learning

We Are TOTALLY Amused: A T-SQL Error

This has to be the best error I’ve ever seen: Msg 195, Level 15, State 10, Line 2 ‘SUM’ is not a recognized built-in function name. Uhm, I’m sorry to contradict you SQL Server, but yes it is. Here’s the code that produced that error: SELECT keyID , SUM(CASE WHEN printDate IS NULL THEN 1 ELSE […]

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 […]