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
A paper calendar with the last day of the month circled in red.

SQL SERVER – Find Last Day of Any Month – Current Previous Next

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

Find the last day of any month with DATEADD and DATEDIFF. One script returns the last day of the previous, current and next month in SQL Server.

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
SQL SERVER - UDF - Validate Integer Function

SQL SERVER – UDF – Validate Integer Function

August 11, 2007
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts

ISNUMERIC() returns 1 for plus, minus and currency signs, so it is not a safe check. I share the UDF I use to validate integer values instead.

Read More
Wall covered with many vintage clocks showing different times

SQL SERVER – UDF – Function to Get Previous And Next Work Day – Exclude Saturday and Sunday

July 23, 2007
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

Inspired by a ColdFusion post by Ben Nadel, here is the UDF I use to get the previous or Next Work Day for any date, skipping Saturday and Sunday.

Read More
SQL SERVER - UDF - Get the Day of the Week Function

SQL SERVER – UDF – Get the Day of the Week Function

July 23, 2007
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Utility

Get the day of the week as a name in SQL Server: a UDF using DATEPART with CASE, plus the simpler DATENAME(dw, GETDATE()) a reader suggested.

Read More
SQL SERVER - SPACE Function Example

SQL SERVER – SPACE Function Example

July 19, 2007
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts

Does SQL Server have a SPACE function? Yes. SELECT SPACE(100) returns 100 spaces, and a short example uses it to join last and first names.

Read More
SQL SERVER - CASE Statement in ORDER BY Clause - ORDER BY using Variable

SQL SERVER – CASE Statement in ORDER BY Clause – ORDER BY using Variable

July 17, 2007
Pinal Dave
SQL Performance
SQL Function, SQL Scripts

Stop building ORDER BY strings and running them with EXEC in a stored procedure. I show how a CASE statement in ORDER BY sorts by a variable without dynamic SQL.

Read More
Previous 1 … 53 54 55 56 57 58 59 … 63 Next
  • Books
  • Testimonials
  • Privacy Policy

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