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
An icon set with time, calendars and checkmarks.

SQL Server – Formatted Date and Alias Name in ORDER BY Clause

September 28, 2018
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Order By, SQL Scripts, SQL Server

Format a date with CONVERT, then use its alias in ORDER BY, and the rows come back in a different order. Here is a simple example of this formatted date surprise.

Read More
Two pies cooling on a board, one with a solid crust and one with a lattice showing the filling

Inline Table-Valued Functions: Parameterized Views That Stay Fast

September 22, 2018
Pinal Dave
SQL Performance
Execution Plan, SQL Function, SQL Performance, SQL Server, SQL View

Compare inline table-valued functions with scalar functions, preserve customer results, and inspect plans before claiming performance gains.

Read More
Gouache illustration of the first and last day of the current date's month, using the first and last sheets between two bookends.

SQL SERVER – Simple Method to Find FIRST and LAST Day of Current Date

September 20, 2018
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

I calculate the FIRST and LAST Day of Current Date using explicit date boundaries. The historical sample starts on October 28, 2017.

Read More
Two empty bowls receive nothing from a closed wooden gate and a plugged pottery jug

Which is Optimal – TOP 0 OR WHERE 1 = 2? – Interview Question of the Week #190

September 9, 2018
Pinal Dave
SQL Interview Questions and Answers
SQL Function, SQL Scripts, SQL Server

Which is optimal, TOP 0 or WHERE 1 = 2? Many interview answers get this wrong, but they are both the same, and STATISTICS IO shows why.

Read More
A to Z alphabet smiley faces.

Alphabets – SQL SERVER – Retrieving Rows With All Alphabets From Alphanumeric Data

September 4, 2018
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server, SQL String

I got an email from one of my blog readers asking for an easy way to identify if a given string contains only alphabets. There can be methods.

Read More
User defined function to extract only numbers from string.

SQL SERVER – UDF – User Defined Function to Extract Only Numbers From String – Number Table Method

August 30, 2018
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server

I rewrote my User Defined Function to extract only numbers from a string. The new one uses a numbers table, also called a Tally table, instead of a WHILE loop.

Read More
Gouache painting of a basket holding one vermilion pear beside a full crate of pears

SELECT COUNT Without FROM Returns 1, Not an Error

August 13, 2018
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server

A SELECT COUNT without FROM does not fail in T-SQL. It returns 1, because the table name after COUNT(*) becomes a column alias. This post shows the typo, the other silent mistakes that work the same way, and the habits that make them fail loudly.

Read More
Previous 1 … 10 11 12 13 14 15 16 … 92 Next
  • Books
  • Testimonials
  • Privacy Policy

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