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
SQL Server query result window.

SQL SERVER – Puzzle and Answer – REPLICATE over 8000 Characters

May 13, 2013
Pinal Dave
SQL Puzzle
SQL Function

A quick Monday puzzle: what happens when you REPLICATE over 8000 characters into a VARCHAR(MAX) variable? Guess the lengths before you run it.

Read More
Gouache painting of a harbor anchor chain broken in two by a missing link, with the lone link painted red

CONCAT_NULL_YIELDS_NULL and CONCAT: How NULL Behaves in Strings

May 12, 2013
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL NULL, SQL Scripts, SQL Server

The CONCAT_NULL_YIELDS_NULL setting decides whether a string plus NULL returns NULL. The CONCAT function never looks at it and treats NULL as an empty string. This post tests both on a customer table, shows the errors the OFF setting causes, and gives safe patterns for names and numbers.

Read More
A lazy susan with seven colored bowls, including a red one, around a ring.

Weekday Logic That Works Under Any DATEFIRST Setting

April 27, 2013
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

Make weekday logic independent of DATEFIRST with a normalized offset or a known Monday, then test every date in a full year.

Read More
A hand topping cupcakes with red raspberries, the last cupcake left plain on the tray.

CROSS APPLY and OUTER APPLY in Everyday Queries

April 13, 2013
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Joins, SQL Scripts, SQL Server

Use CROSS APPLY and OUTER APPLY for per-row functions, reusable expressions, VALUES unpivoting, DMV text, plans, and latest rows.

Read More
A solid slate-colored rectangular tile beside a sage triangular tile, a loose cream cord and a red pebble.

geometry STArea: Measure the Polygon Interior

April 11, 2013
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL Scripts, SQL Server

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.

Read More
SQL query tool window.

SQL SERVER – Avoid Using Function in WHERE Clause – Scan to Seek

March 12, 2013
Pinal Dave
SQL Performance
SQL Function, SQL Index

Does a function in WHERE clause really hurt performance? Using AdventureWorks and STATISTICS IO, I show what happens and how to turn a scan into a seek.

Read More
SQL SERVER - Check If String is a Palindrome in Using T-SQL Script - Reverse Function

SQL SERVER – Check If String is a Palindrome in Using T-SQL Script – Reverse Function

March 7, 2013
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server, SQL String

A friend building a captcha had to skip words that read the same backward. Here is a T-SQL script with REVERSE to check if a string is a Palindrome.

Read More
Previous 1 … 30 31 32 33 34 35 36 … 92 Next
  • Books
  • Testimonials
  • Privacy Policy

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