A closure table stores ancestor and descendant paths. Read those relationships efficiently and compare them with the authoritative parent edges.
SQL SERVER – Downgrade Database to Previous Version
Can you downgrade database files from SQL Server 2005 to 2000? No tool does it. Install the old version, recreate the schema and move the data yourself.
SQL SERVER – Introduction and Example of UNION and UNION ALL
A simple example of UNION and UNION ALL with two table variables. UNION removes the duplicate rows, while UNION ALL keeps every row from both tables.
SQL SERVER – Get Numeric Value From Alpha Numeric String – UDF for Get Numeric Numbers Only
A simple UDF that gets only the numbers from an alpha numeric string, using PATINDEX and STUFF, with test values for empty, NULL and mixed strings.
JSON_QUERY or JSON_VALUE: Match the JSON Shape
JSON_QUERY or JSON_VALUE depends on the JSON shape you need. One read-only document exposes scalar, object, array, JSON null and missing-path results side by side.
SQLAuthority News – SQL Injection – SQL Joke, SQL Humor, SQL Laugh
The SQL Injection cartoon readers sent me many times, finally on the blog. Plus a demo of how dynamic SQL opens the door to it, and a way to close it.
OLE DB or ODBC for Connecting to SQL Server
Choose OLE DB or ODBC for SQL Server by the component you run, especially SSIS, linked servers, and applications using current drivers.
SQL SERVER – 2008 – Enhenced TRIM() Function – Remove Trailing Spaces, Leading Spaces, White Space, Tabs, Carriage Returns, Line Feeds
Need to remove trailing spaces, leading spaces, tabs, carriage returns and line feeds? Here is an enhanced TRIM function built from a script by Russ and Erik.
SQL SERVER – 2008 – TRIM() Function – User Defined Function
SQL Server 2000, 2005 and 2008 have no TRIM() function, but LTRIM and RTRIM together do the job. Here is a simple UDF that trims both sides at once.
SUBSTRING Boundaries: Start at Zero, One or Beyond
SUBSTRING boundaries distinguish start zero, start one and positions past the end. Read empty strings, shortened counts and typed NULL results.










