LEN works for VARCHAR but not for TEXT. To find the length of text field data, use DATALENGTH(textfield). A one line example shows how.
SQL SERVER – Delay Function – WAITFOR clause – Delay Execution of Commands
The WAITFOR clause delays a batch, stored procedure or transaction until a set time or for an interval. I use it daily after restores. DELAY and TIME examples.
SQL SERVER – 2005 – UDF – User Defined Function to Strip HTML – Parse HTML – No Regular Expression
A simple SQL Server function to parse HTML and keep only the text, with no regular expressions needed. Copy the UDF and try it on your own data.
SUM Integer Values: Cast Before the Aggregate
SUM integer values can exceed int even when each row fits. Cast each input to bigint before aggregation and keep NULL and empty-set behavior visible.
SQL SERVER – Easy Sequence of SELECT FROM JOIN WHERE GROUP BY HAVING ORDER BY
The sequence of SELECT, FROM, JOIN, WHERE, GROUP BY, HAVING and ORDER BY that I gave my new hires. Since then they ask me far fewer questions.
How to Read a SQL Server Error Message
Read a SQL Server error message by separating its number, severity, state, procedure, and line, then preserve the context needed to investigate.
Normalization Jokes and the Normal Forms They Make Fun Of
Normalization jokes are funny because they are true. Here are the classics in my own words, and the first three normal forms they poke fun at.







