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: a leather sack tipped over a wooden chute pours golden grain into a narrow stoneware crock, which overflows across the bench

SUM Integer Values: Cast Before the Aggregate

June 15, 2007
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL Scripts

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.

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
SQL SERVER - 2005 T-SQL Paging Query Technique Comparison (OVER and ROW_NUMBER()) - CTE vs. Derived Table

SQL SERVER – 2005 T-SQL Paging Query Technique Comparison (OVER and ROW_NUMBER()) – CTE vs. Derived Table

June 11, 2007
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Joins, SQL Paging, SQL Scripts, SQL Server

Paging in SQL Server 2005 with ROW_NUMBER: CTE vs. derived table. I compare both methods and show they give the same performance for common queries.

Read More
Gouache illustration for the date part example: a fern and its simplified outline beside a wooden press.

SQL SERVER – Retrieve – Select Only Date Part From DateTime – Best Practice

June 10, 2007
Pinal Dave
SQL Tips and Tricks
Best Practices, SQL DateTime, SQL Function, SQL Scripts, SQL Server

Selecting the date part and formatting it are different tasks. I keep typed dates for calculations and text for display.

Read More
SQL SERVER - UDF - Function to Display Current Week Date and Day - Weekly Calendar

SQL SERVER – UDF – Function to Display Current Week Date and Day – Weekly Calendar

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

A script and UDF that show each current week date with its day, from Sunday to Saturday, using DATEPART and DATEADD. Handy for a weekly calendar report.

Read More
Two rounded stones rest on a sage-green mat, while a dark blue stone rests on a separate slate-blue mat beside a knotted cord.

geometry SRID Mismatch: NULL Is Not a Zero Distance

June 6, 2007
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL NULL, SQL Server

geometry SRID mismatch is different from coincident points. Keep both identifiers beside the distance and preserve the distinction between NULL and zero.

Read More
SQL SERVER - User Defined Functions (UDF) Limitations

SQL SERVER – User Defined Functions (UDF) Limitations

May 29, 2007
Pinal Dave
SQL Tips and Tricks
SQL Function

Why are stored procedures more flexible? Here are the User Defined Functions (UDF) limitations: fewer input parameters, no GETDATE(), one result set, and more.

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

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