Category: TSQL

Applied SQL: Server Side Traces

It’s time to get your server side trace on, with a little practical application! I introduce this whole concept in Applied SQL: You Have Homework. Find all assignments on the Applied SQL page. Prerequisites: basic T-SQL, basic experience with SQL Profiler Reading: SQLServerPedia article: The Server-side Trace: What, Why, and How    SQL Server Books Online […]

Applied SQL: sys.sql_modules

I introduce this whole concept in Applied SQL: You Have Homework. Find all assignments on the Applied SQL page. Prerequisites: basic T-SQL (including JOINs and LIKE), basic knowledge of catalog views Reading: SQL Server Books Online sys.sql_modules article. Level 1 Assignments: Using sys.sql_modules, write a query for each of the following: Find all object definitions […]

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