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 handplane removes fine shavings while the wooden board remains intact

How to Trim TIME Part in DATETIME Values? – Interview Question of the Week #200

November 18, 2018
Pinal Dave
SQL Interview Questions and Answers
SQL DateTime, SQL Function, SQL Server, SQL String

How to trim TIME part in DATETIME values? A reader wanted to keep only the date and the hour, so here are ways to cut off the minutes and seconds.

Read More
Result column flipping between 1 and 0.

Puzzle – Datatime to DateTime2 Conversation in SQL Server 2017

November 16, 2018
Pinal Dave
SQL Puzzle
SQL DateTime, SQL Scripts, SQL Server, SQL Server 2017

At PASS, SQL Server expert Christopher Savage showed me a puzzle on DateTime to DateTime2 conversion in SQL Server 2017. I still have no answer, so can you solve it?

Read More
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
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
Year 1904 Answer.

SQL SERVER – Puzzle – How Does YEAR Function Work?

March 13, 2018
Pinal Dave
SQL Puzzle
SQL DateTime, SQL Function, SQL Scripts, SQL Server

SELECT YEAR(35000/20) returns 1904, which looks strange. This puzzle shows how the YEAR function treats a plain integer. Can you explain the result?

Read More
SQL SERVER - Msg 3225: Use of WITH CREDENTIAL Syntax is Not Valid for Credentials Containing a Shared Access Signature

SQL SERVER – Msg 3225: Use of WITH CREDENTIAL Syntax is Not Valid for Credentials Containing a Shared Access Signature

December 11, 2017
Pinal Dave
SQL Tips and Tricks
SQL Backup and Restore, SQL DateTime, SQL Error Messages, SQL Scripts, SQL Server

Backup to URL worked, but a maintenance plan failed with Msg 3225: WITH CREDENTIAL is not valid for credentials with a Shared Access Signature. Here is the fix.

Read More
A chairlift of evenly spaced empty chairs climbing a snowy slope, with one gap where a chair is missing

Longest Streak of Consecutive Days in T-SQL: Gaps and Islands

November 1, 2017
Pinal Dave
SQL Tips and Tricks
Ranking Functions, SQL DateTime, SQL Scripts, SQL Server

Find the longest streak of consecutive days in T-SQL with gaps and islands: group dates with ROW_NUMBER, handle duplicates, and list gaps.

Read More
Previous 1 … 3 4 5 6 7 8 9 … 29 Next
  • Books
  • Testimonials
  • Privacy Policy

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