This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
Gouache painting: on a bakery bench a narrow stoneware crock holds risen dough that has been sliced flat at its rim by a bench scraper

REPLACE Return Limits: Cast the Input to max

June 28, 2007
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL String

REPLACE return limits can truncate text at 8,000 bytes. Cast the searched input to max first, then compare Unicode and non-Unicode byte lengths.

Read More
SQL SERVER - Repeate String N Times Using String Function REPLICATE

SQL SERVER – Repeate String N Times Using String Function REPLICATE

June 25, 2007
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL String

REPLICATE repeats a string N times. I found this T-SQL string function while searching for replication, and it is handy when you need repeated text.

Read More
Two identical white enamel jugs side by side on a shelf, one completely empty and one holding a single measure of water.

SQL SERVER – Explanation and Comparison of NULLIF and ISNULL

June 22, 2007
Pinal Dave
SQL Tips and Tricks
DBA, SQL Function, SQL NULL, SQL Scripts, SQL Server

NULLIF returns NULL when two expressions are equal and the first one when they are not. Here is how it compares with ISNULL and the matching CASE expression.

Read More
Gouache painting of three differently shaped hourglasses on a stone garden wall, the middle one with red sand

Current Date and Time in SQL Server: GETDATE, SYSDATETIME and More

June 21, 2007
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts

You can read the current date and time in SQL Server in eight ways, and they differ in precision and time zone. This post runs them side by side, shows that each one is evaluated once per statement, and picks the right one for defaults, audit columns and reports.

Read More
SQL SERVER - Find Length of Text Field

SQL SERVER – Find Length of Text Field

June 20, 2007
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts

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.

Read More
SQL SERVER - Delay Function - WAITFOR clause - Delay Execution of Commands

SQL SERVER – Delay Function – WAITFOR clause – Delay Execution of Commands

June 18, 2007
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts

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.

Read More
SQL SERVER - 2005 - UDF - User Defined Function to Strip HTML - Parse HTML - No Regular Expression

SQL SERVER – 2005 – UDF – User Defined Function to Strip HTML – Parse HTML – No Regular Expression

June 16, 2007
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server, SQL String

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.

Read More
Previous 1 … 82 83 84 85 86 87 88 … 92 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com