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 - Explanation and Understanding NOT NULL Constraint

SQL SERVER – Explanation and Understanding NOT NULL Constraint

October 15, 2007
Pinal Dave
SQL Performance
SQL Constraint and Keys, SQL Joins, SQL NULL, SQL Scripts

What a NOT NULL constraint does and two ways to add one: when the table is created, or after the table is created. My example covers both.

Read More
Two glass jars stand side by side, one empty and one holding red seeds.

COUNT_BIG: Count Rows and Non-NULL Values as bigint

September 12, 2007
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL NULL, SQL Scripts, SQL Server

COUNT_BIG helps me name the counting rule before reading the result. Compare rows, supplied values and distinct readings. Then check empty results and the bigint return type.

Read More
A wooden coin-sorting tray with coins stacked by size, one large coin stuck in the wrong channel, a bag of coins beside it.

GROUP BY Done Right

August 14, 2007
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Group By, SQL Joins, SQL NULL, SQL Server

GROUP BY Done Right separates row filters from group filters, handles NULL groups, and avoids totals inflated by careless joins.

Read More
A plain pale wooden block with a square opening beside a larger vermilion cube.

TRY_CONVERT Integer Validation: Check the Target Type

July 11, 2007
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL NULL, SQL Server

TRY_CONVERT integer validation starts with the destination type and a separate input policy. This example compares blank, signed, decimal and overflowing text without writing data.

Read More
Sage and slate-blue ceramic beads, a small vermilion spacer and an empty ring on a braided cord.

CONCAT_WS: Keep NULL and Empty Strings Separate

July 5, 2007
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL NULL, SQL Server, SQL String

CONCAT_WS joins values with a separator, but NULL and empty strings have different effects. These examples keep the original fields beside the combined text and byte length.

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
SQL SERVER - LEN and DATALENGTH of NULL Simple Example

SQL SERVER – LEN and DATALENGTH of NULL Simple Example

June 12, 2007
Pinal Dave
SQL Performance
SQL Function, SQL NULL, SQL Scripts

A common mistake is checking LEN(@var) = 0 for a NULL value. LEN and DATALENGTH of NULL both return NULL, not zero, as this simple example shows.

Read More
Previous 1 … 8 9 10 11 12 Next
  • Books
  • Testimonials
  • Privacy Policy

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