How do I return a few chosen rows at the bottom of the entire resultset, in my own order? A T-SQL script on AdventureWorks shows how to do it.
CROSS APPLY and OUTER APPLY in Everyday Queries
Use CROSS APPLY and OUTER APPLY for per-row functions, reusable expressions, VALUES unpivoting, DMV text, plans, and latest rows.
geometry STArea: Measure the Polygon Interior
geometry STArea measures polygon interior rather than its outline. These local planar shapes show equal areas with different perimeters, a hole subtraction and zero-area instances.
SQL SERVER – The procedure attempted to return a status of NULL, which is not allowed. A status of 0 will be returned instead.
Why does SQL Server say a procedure attempted to return a status of NULL and returns 0 instead? A reader asked on Facebook, and I explain what it means.
How to Pass Stored Procedure Result to Another Procedure in SQL Server
To pass stored procedure result values from one procedure to another, use an OUTPUT parameter. This post tests RETURN codes, INSERT … EXEC and table-valued parameters on a small order demo. It also shows the errors each method raises and when a function is the better tool.
SQL SERVER – Group by Rows and Columns using XML PATH – Efficient Concating Trick
A reader wanted students and courses grouped by course and instructor in a single row. Here is a simple concatenation trick with XML PATH that does it.







