Are Cursors in SQL Server Evil? Part Two: How to Use Cursors in Transact-SQL
May 8,
2015
In the previous installment, we looked at the numerous options for declaring a cursor. All that remains is the easy part: fetching data from a cursor. To do this, we shall have to declare variables for each of the columns of the cursor. For purposes of clarity and ease of understanding, I see no reason […]
How to Use CROSS APPLY with Derived Tables in Transact SQL Queries
Jan 18,
2015
Armelle G, a student in Learning Tree’s SQL Server Transact-SQL Programming course asks “Is CROSS APPLY only used with T-SQL Functions?” Great question Armelle! Many SQL Server folks would answer “yes” but the fact is that CROSS APPLY can also be used with subqueries. CROSS APPLY allows you to create the equivalent of correlated derived tables in […]
Which Standard Deviation & Variance to use in Excel (and SQL!).
Dec 15,
2014
A look at STDEV, STDEVP, VAR and VARP- Amy M., from Developing SQL Queries for SQL Server, writes… “I know there are two functions for standard deviation and for variance in Transact-SQL, but I can never remember when to use which.” You are so right, Amy. It is hard to know when to use STDEV […]
Analyzing Queries with a SQL Profiler
May 23,
2012
I teach a number of courses that include technologies that wrap up data access–everything from Entity Framework to WCF Data Services to RIA Services. They all simplify the business of working with data–but at the cost of hiding the implementation from the developer. One question that continually crops up in class is: how do I […]