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 of three hats on stands with the chosen one painted vermilion

Current Language of a SQL Server Session: How to Check It

February 8, 2019
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts

To find the current language of a SQL Server session, read @@LANGUAGE or @@LANGID, or query sys.dm_exec_sessions. This post tests each one, switches the session to German and British, and shows how the language changes month names and how text turns into dates.

Read More
Gouache painting of a wooden shape sorter box with matching blocks and one vermilion star block beside it

Find the Data Type of an Expression in SQL Server

January 23, 2019
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL Scripts

To find the data type of an expression in SQL Server, pass it to SQL_VARIANT_PROPERTY or describe the whole query with sys.dm_exec_describe_first_result_set. This post tests both on a percentage calculation, shows how precision and scale come out, and explains why 2147483647 plus 1 fails.

Read More
Parked cars along a curb seen from above with gaps between them, one wide enough for a car, one too short

Finding Free Time Slots in a Calendar With GENERATE_SERIES

January 12, 2019
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Server, SQL Server 2022

Find free time slots with GENERATE_SERIES, exclude overlapping bookings, and merge busy intervals before calculating calendar gaps.

Read More
50 Length shown in Varchar.

SQL SERVER – Measuring the Length of VARCHAR and NVARCHAR Columns with COL_LENGTH

December 29, 2018
Pinal Dave
SQL Tips and Tricks
SQL Column, SQL Datatype, SQL Function, SQL Scripts, SQL Server

Does an NVARCHAR column take twice the space of VARCHAR? Yes. I measure the length of VARCHAR and NVARCHAR columns with COL_LENGTH to show it.

Read More
Gouache painting of a short straight path and a long winding path leading to the same vermilion gate

IIF in SQL Server: IF THEN Logic Compared With CASE

December 24, 2018
Pinal Dave
SQL Tips and Tricks
Execution Plan, SQL CASE, SQL Function, SQL Scripts

IIF in SQL Server is a short way to write IF THEN logic with two outcomes. This post compares it with CASE in a small juice shop table, shows that both produce the same plan, and covers NULL, data types and the WHERE clause.

Read More
A laden plum tree with a tiny bowl at its foot and a large red crate beside it.

Multi-Statement Table-Valued Functions and Interleaved Execution

November 21, 2018
Pinal Dave
SQL Performance
Execution Plan, SQL Function, SQL Performance, SQL Server 2017

See how interleaved execution corrects estimates for multi-statement table-valued functions and when an inline rewrite wins.

Read More
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
Previous 1 … 9 10 11 12 13 14 15 … 92 Next
  • Books
  • Testimonials
  • Privacy Policy

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