Functions

Learn SQL Server functions with practical tips, examples, and tutorials to improve querying and data analysis.

Title Author Date
SQL Server Functions – VARP, SOUNDEX and NTILE Derek Colley2026-06-09
Convert a String to JSON with SQL Server Queries Joe Gavin2026-06-03
SQL Format Currency Code Examples Daniel Calbimonte2026-05-27
SQL Server Current Date Jim Evans2026-05-27
Split Delimited String into Columns in SQL Server Aubrey Love2026-05-14
Creating a date dimension or calendar table in SQL Server Aaron Bertrand2026-05-13
Date Truncation with DATETRUNC() function in SQL Server Rajendra Gupta2026-05-06
Format SQL Server Dates with FORMAT Function Daniel Calbimonte2026-05-04
SQL PIVOT and SQL UNPIVOT Examples to Transform Data Daniel Calbimonte2026-05-03
SQL Date Format Examples using CONVERT Function MSSQL Tips2026-05-02
New SQL Regex Functions in SQL Server 2025 and SSMS Scott Murray2025-11-19
SQL Format Number with CAST, CONVERT and more Daniel Calbimonte2025-10-31
SQL Concat Operator and UNISTR Function in Azure Koen Verbeeck2025-09-22
Script to Create a SQL Time Dimension Table Koen Verbeeck2025-06-25
Simplify SQL Date Calculations – First, Last, Nth Day of the Month Aaron Bertrand2025-06-10
SQL Convert INT to String Daniel Calbimonte2025-05-28
Calculate Difference Between Two SQL Dates as hh:mi:ss or hh:mi Sean Lee2025-05-27
SQL Convert Date to YYYYMMDD Jim Evans2025-05-27
SQL Server System Functions for Server and Database Properties Arshad Ali2025-05-21
Video on how to create your own RANDBETWEEN function for SQL Server Dallas Snider2025-05-21
SQL CURRENT_TIMESTAMP Function Use and Examples Daniel Calbimonte2025-04-28
SQL DATEADD Function Use and Examples Daniel Calbimonte2025-04-28
SQL DATEDIFF Function Use and Examples Daniel Calbimonte2025-04-28
SQL DATEFROMPARTS Function Use and Examples Daniel Calbimonte2025-04-28
SQL DATENAME Function Use and Examples Daniel Calbimonte2025-04-28
SQL DATEPART Function Use and Examples Daniel Calbimonte2025-04-28
SQL DAY Function Use and Examples Daniel Calbimonte2025-04-28
SQL GETDATE Function Use and Examples Daniel Calbimonte2025-04-28
SQL GETUTCDATE Function Use and Examples Daniel Calbimonte2025-04-28
SQL ISDATE Function Use and Examples Daniel Calbimonte2025-04-28
SQL MONTH Function Use and Examples Daniel Calbimonte2025-04-28
SQL SYSDATETIME Function Use and Examples Daniel Calbimonte2025-04-28
SQL YEAR Function Use and Examples Daniel Calbimonte2025-04-28
SQL Server Date and Time Data Type Comparison Aaron Bertrand2025-04-27
Recommended SQL Server Date Formats Aaron Bertrand2025-04-27
SQL Server Between Dates Issue Aaron Bertrand2025-04-27
SQL Server Date Time Shorthand and Other Tricks Aaron Bertrand2025-04-27
Evaluating the Randomness of SQL Server Random Number Functions Rick Dobson2025-04-24
Gauss-Seidel Method SQL Function to Solve Linear Equations Sebastiao Pereira2025-03-10
Lagrange Interpolation Function for SQL Server Sebastiao Pereira2025-03-04
Basic Regex Emulator for SQL Server Sebastiao Pereira2025-02-25
SQL Server JSON Functions JSON_OBJECTAGG and JSON_ARRAYAGG Koen Verbeeck2025-02-24
Concatenate SQL Server Column Values with CONCAT() Chad Churchwell2025-01-13
Select SQL Server Data Between Two Dates Hadi Fadlallah2025-01-08
Add and Subtract Dates using DATEADD in SQL Server Tim Cullen2025-01-02
SQL Server Date and Time Functions with Examples Joe Gavin2024-12-31
SQL Server Functions for Tables, Views, Indexes, Columns, and more Arshad Ali2024-08-13
Standardize Text with Multi Search and Replace Function in SQL Server Greg Robidoux2024-06-21
SQL Convert Examples for Dates, Integers, Strings and more Joe Gavin2024-05-28
NTILE SQL Function to Group and Rank Datasets Harris Amjad2023-07-05
SQL Server JSON_PATH_EXISTS Function Daniel Calbimonte2023-06-08
SQL Server ISJSON for valid Value, Array or Object JSON format Daniel Calbimonte2023-05-25
SQL SUM Function for Aggregating and Summarizing Totals John Miner2023-04-20
Build a Time Slicer by Week using DAX Kenneth A. Omorodion2023-04-12
Learn about SQL Date Data Types – Date, DateTime, DateTime2, Time Hadi Fadlallah2023-03-15
TRY_PARSE Functionality for SQL Server 2008 to Determine Valid Dates Aaron Bertrand2023-03-09
SQL Calendar Table Simplified using a Table and a View Aaron Bertrand2023-02-22
Troubleshoot Performance with User Defined Functions in SQL Server Eric Blinn2023-02-13
SQL Server ROW_NUMBER Ranking Function that Returns a Row Rank Value Jared Westover2023-02-08
Generate Events Calendar in HTML with SQL Server and CSS Aaron Bertrand2023-02-07
How to get Time from a RowVersion value with T-SQL Code Eric Blinn2022-12-02
SQL COUNT DISTINCT and SQL COUNT Examples in SQL Server Eric Blinn2022-11-22
SELECT COUNT FROM SQL Server Examples and Statistics Jared Westover2022-11-16
SQL Server Logarithmic Functions LOG() and LOG10() for Data Outliers Harris Amjad2022-10-20
Deciding between COALESCE and ISNULL in SQL Server Aaron Bertrand2022-10-03
The Many Uses of Coalesce in SQL Server Ken Simmons2022-09-30
SQL Server OBJECTPROPERTY Function Examples Manvendra Singh2022-09-30
SQL CONVERT, CAST, TRY_CAST, TRY_CONVERT and TRY_PARSE Examples Jared Westover2022-08-30
Metadata Functions in SQL Server SERVERPROPERTY, DB_NAME, OBJECT_ID Manvendra Singh2022-08-19
SQL Concatenate Strings Example Daniel Calbimonte2022-08-12
Delay SQL Code Execution with SQL WAITFOR Aubrey Love2022-08-08
Create an Extended Date Dimension for a SQL Server Data Warehouse Dinesh Asanka2022-08-04
SQL COUNT and SQL COUNT_BIG Functions Manvendra Singh2022-07-13
Random Date Generator in SQL Server Jared Westover2022-07-12
SQL Server Configuration Functions Manvendra Singh2022-07-06
SQL Average Function to Calculate Average of a set of SQL Server Rows Manvendra Singh2022-06-22
SQL MAX Examples and Use Cases Manvendra Singh2022-05-05
DATEADD SQL Function to Add and Subtract Dates and Times Manvendra Singh2022-04-26
SQL DATEDIFF and DATEDIFF_BIG Functions with Sample Code Manvendra Singh2022-04-11
SQL Server datetimeoffset for Time Zones Eric Blinn2022-03-14
SQL Date Format Comparison for Computed Column and Materialized Column Aaron Bertrand2022-03-01
Parameter List for all SQL Server Stored Procedures and Functions Atif Shehzad2022-02-23
SQL Date Format Comparison – SQL FORMAT vs. SQL CONVERT Aaron Bertrand2022-02-16
Learn SQL CAST Function with Examples and Alternatives Koen Verbeeck2022-02-01
SQL Substring Examples for T-SQL, R and Python Siddharth Mehta2022-01-24
SQL REPLACE Overview and Examples Garry Bargsley2022-01-24
SQL Convert Function In Depth Ben Snaidero2022-01-20
Azure SQL Database GREATEST and LEAST functions Aaron Bertrand2021-12-08
SQL Aggregate Functions Code Samples Koen Verbeeck2021-12-03
SQL Server FORMAT Dates, Numbers and SQL Server Agent Dates Jeffrey Yao2021-10-28
SQL COUNT Code Examples Aubrey Love2021-10-25
SQL Concatenate Examples Koen Verbeeck2021-10-05
Examples for SQL CAST and SQL CONVERT Functions Koen Verbeeck2021-09-16
SQL Server Rounding Functions – Round, Ceiling and Floor Jeremy Kadlec2021-07-20
Create a Calendar Table in SQL Server to Optimize Scheduling Problems Aaron Bertrand2021-06-16
SQL CAST Function for Data Type Conversions Aubrey Love2021-05-25
SQL DATE Functions Jim Evans2021-05-18
SQL Server SERVERPROPERTY() Use Cases Manvendra Singh2021-04-30
Calendar Table in SQL Server to Identify Date Gaps and Islands Aaron Bertrand2021-04-28
SQL Server Calendar Table Example Aaron Bertrand2021-04-22
COALESCE SQL Function Jim Evans2021-03-22
SQL ISNULL Function Examples Ben Snaidero2021-03-18
SQL Server Date Format YYYY-MM-DD Considerations Aaron Bertrand2021-03-04
CONCAT SQL Function in SQL Server Rajendra Gupta2021-02-22
SQL Window Functions in SQL Server Eric Blinn2021-02-16
Randomly Retrieve SQL Server Records Greg Robidoux2020-09-02
Retrieving random data from SQL Server with TABLESAMPLE Greg Robidoux2020-09-02
SQL Server Regex CLR Function Ian Fogelman2020-08-20
Valid Email Address Check with TSQL Matteo Lorini2020-08-18
DATEDIFF SQL Server Function Jim Evans2020-07-16
How to Expand a Range of Dates into Rows using a SQL Server Numbers Table Koen Verbeeck2020-07-15
SQL Server Split String Replacement Code with STRING_SPLIT Aaron Bertrand2020-06-01
Generate Unique Random Number in SQL Server Rick Dobson2020-04-01
Weighted vs Simple Moving Average with SQL Server T-SQL Code Rick Dobson2020-03-16
Get SQL Server UDF Create, Modified, Last Execution Date and Code Rick Dobson2019-11-20
Update only Year, Month or Day in a SQL Server Date Atul Gaikwad2019-11-14
SQL Server User Defined Function Example Rick Dobson2019-11-01
SQL Server User Defined Function Overview Rick Dobson2019-10-08
SQL Server STRING SPLIT Limitations Aaron Bertrand2019-09-03
Fill In Missing Dates for SQL Server Query Output Jim Evans2019-07-12
Simplify Date Period Calculations in SQL Server Aaron Bertrand2019-06-27
SQL Server function to convert integer date to datetime format Tim Ford2019-05-24
Get SQL Server Date and Time Parts with DATEPART and DATENAME Tim Cullen2019-05-24
Four ways to improve scalar function performance in SQL Server Aaron Bertrand2019-01-11
Using T-SQL to find events that overlap (or don’t) in SQL Server Aaron Bertrand2018-12-26
Auto Generate Create Table Script Based on SQL Server Query Daniel Farina2018-10-05
Determine SQL Server Network Protocol Information using T-SQL and DMVs Eduardo Pivaral2018-08-06
Using FOR XML PATH and STRING_AGG() to denormalize SQL Server data Aaron Bertrand2018-06-22
Understanding and Using SQL Server sys.dm_exec_requests K. Brian Kelley2018-06-20
T-SQL Starter Statistics Package for SQL Server Rick Dobson2018-06-07
Understanding and Using sys.dm_exec_sessions in SQL Server K. Brian Kelley2018-06-06
CLR String Sort Function in SQL Server Greg Robidoux2018-05-29
Overview of SQL Server Table-Valued Functions sys.dm_exec_cursors and sys.dm_db_log_info Jayendra Viswanathan2018-05-02
Computed Columns with Scalar Functions SQL Server Performance Issue Ahmad Yaseen2018-04-27
Simulating TRY_CONVERT() in SQL Server 2008 – Part 2 Aaron Bertrand2018-04-25
Simulating TRY_CONVERT() in SQL Server 2008 Aaron Bertrand2018-04-02
SQL Server STRING_AGG and STRING_SPLIT functions Aaron Bertrand2018-01-19
T-SQL: Capture Related Data and Return By Aggregates Tim Smith2017-12-07
SQL Server DateTime Best Practices Aaron Bertrand2017-11-15
Additional SERVERPROPERTY properties in SQL Server Ahmad Yaseen2017-08-16
SQL Server function to check dynamic SQL syntax Eli Leiba2017-08-02
Dealing with the single-character delimiter in SQL Server’s STRING_SPLIT function Aaron Bertrand2017-06-22
SQL Server 2016 STRING_SPLIT Function Ahmad Yaseen2017-05-17
Validate Integer and Decimal Values in SQL Server Bhavesh Patel2017-05-11
Refactor SQL Server scalar UDF to inline TVF to improve performance Simon Liew2017-03-22
Understand the Performance Behavior of SQL Server Scalar User Defined Functions Simon Liew2017-02-09
Handling Special Dates For SQL Server Metrics Tim Smith2016-12-01
Create a SQL Server InitCap Function Eli Leiba2016-09-26
SQL Server COUNT() Function Performance Comparison Simon Liew2016-09-19
Max, Min, and Avg SQL Server Functions Tim Wiseman2016-08-23
Select min and max values along with other SQL Server columns using T-SQL Dallas Snider2016-08-22
Min-Max Normalization in T-SQL when the Boundaries are not [0,1] Dallas Snider2016-07-19
Count of rows with the SQL Server COUNT Function Tim Wiseman2016-07-07
Parsing string data with the new SQL Server 2016 STRING_SPLIT function John Miner2016-06-27
SQL Server T-SQL Code to Calculate a Moving Average Dallas Snider2016-03-08
How to find UDFs causing SQL Server performance issues Fikrat Azizov2015-12-07
Build a cheat sheet for SQL Server date and time formats Aaron Bertrand2015-10-13
Converting and Using Text Dates as SQL Server Dates Rick Dobson2015-05-26
How To Calculate Behavioral Streaks in SQL Server Data Tim Smith2015-05-04
Calculate the Statistical Mode in SQL Server using T-SQL Koen Verbeeck2015-03-10
SQL Server Date Time Calculation Examples Jeffrey Yao2015-02-13
SQL Servers Lag and Lead Functions to Help Identify Date Differences Thomas LeBlanc2015-01-19
Getting SQL Server Metadata With Python Tim Wiseman2015-01-16
SQL Server Data Aggregation for Data with Different Sampling Rates Dallas Snider2014-12-04
Name Parsing for up to Two Different Persons from One Name String with SQL Server T-SQL Rick Dobson2014-09-16
Implementing Luhn’s Algorithm in T-SQL to validate credit card numbers Derek Colley2014-08-27
Create Your Own RANDBETWEEN Function in T-SQL Dallas Snider2014-08-04
Name Parsing for Result Sets with Different Name Formats Rick Dobson2014-07-15
Name Parsing with SQL Server Functions and T-SQL Programming Rick Dobson2014-05-22
Handle conversion between time zones in SQL Server – part 3 Aaron Bertrand2014-04-01
Handle conversion between time zones in SQL Server – part 2 Aaron Bertrand2014-03-10
Handle conversion between time zones in SQL Server – part 1 Aaron Bertrand2014-03-04
Different ways to get random data for SQL Server data sampling Derek Colley2014-01-29
Performance Comparison of SQL Server PARSE, CAST, CONVERT Ben Snaidero2013-08-21
Concatenation of Different SQL Server Data Types Chad Churchwell2013-07-29
SQL Server APP_NAME function to control stored procedure execution Siddharth Mehta2013-03-11
SQL Server CLR and SQL split functions to parse a delimited string Greg Robidoux2013-01-14
Restore SQL Server Databases using DateTime functions Brady Upton2012-12-21
SQL Server Function to return a range of dates Albert Hetzel2012-10-25
Using SQL Server Concatenation Efficiently Sherlee Dizon2012-10-18
Percent_Rank and Cume_Dist functions in SQL Server 2012 Rajendra Gupta2012-06-12
SQL Server 2012 Analytical Functions – Percentile_Cont and Percentile_Disc Rajendra Gupta2012-06-01
Work around for calculating age using the SQL Server DateDiff function Rick Dobson2012-05-09
SQL Server Lead and Lag Functions Rajendra Gupta2012-04-16
SQL Server 2012 Functions – First_Value and Last_Value Rajendra Gupta2012-03-12
FORMAT and CONCAT Functions in SQL Server Ashish Kumar Mehta2012-01-24
Introduction to SQL Server CLR table valued functions Diana Moldovan2012-01-16
New Date and Time Functions in SQL Server 2012 Ashish Kumar Mehta2012-01-09
New Logical Functions in SQL Server 2012 (IIF and CHOOSE) Ashish Kumar Mehta2011-12-28
New Data Type Conversion Functions in SQL Server 2012 Ashish Kumar Mehta2011-12-23
Script to calculate the Median value for SQL Server data Eli Leiba2011-10-31
SQL Server DateDiff Example Tim Cullen2011-10-10
Remove HTML tags from strings using the SQL Server CLR Diana Moldovan2011-06-23
Converting UTC to local time with SQL Server CLR Diana Moldovan2011-04-07
Mimic timestamp behavior of other database platforms to store last modified date Murali Krishnan2011-03-10
SQL Server random numerics data generation using CLR Alex Tocitu2011-03-09
Implement financial functions in SQL Server using C# Alex Tocitu2011-03-04
Convert SQL Server DateTime Data Type to DateTimeOffset Data Type John Sterrett2011-02-23
SQL Server Regular Expressions for Data Validation and Cleanup Alex Tocitu2011-02-09
SQL Server function to validate Social Security Numbers SSN Vamsi Bogullu2011-01-10
Using SOUNDEX and DIFFERENCE to Standardize Data in SQL Server Tim Cullen2010-11-16
Execute DOS command when xp_cmdshell is disabled in SQL Server Andy Novick2010-08-11
Multi parameter CLR aggregate in SQL Server 2005 Andy Novick2010-06-21
SQLCLR function to return free space for all drives on a server Andy Novick2010-04-16
SQL Server 2005 and 2008 Ranking Functions DENSE_RANK and NTILE Arshad Ali2010-03-01
SQL Server Ranking Functions Row_Number and Rank Arshad Ali2010-02-17
SQL Server Date function that determines date range based on weekday Tim Ford2009-06-10
Using the OBJECT_SCHEMA_NAME function to return the SQL Server schema name Tim Ford2009-06-04
SQL Server function to convert MSDB integer value to time value Tim Ford2009-05-05
SQL Server UDF to pad a string Tim Ford2009-04-27
SQL Server function to validate email addresses Andy Novick2009-01-23
Finding a string value in a SQL Server table Tim Ford2008-12-29
SQL Server 2008 Date and Time Data Types Tim Ford2008-10-30
TSQL Function to Determine Holidays in SQL Server Tim Cullen2008-07-10
Dynamically controlling the number of rows affected by a SQL Server query Greg Robidoux2008-07-08
Daylight Savings Time Functions in SQL Server Tim Cullen2007-11-13
SQL Server function to determine if all characters are capitalized Tim Ford2007-11-07
Parsing a URL with SQL Server Functions Jeremy Kadlec2007-08-31
SQL Server T-SQL Aggregate Functions Jeremy Kadlec2007-04-12
Getting a SQL Server RowCount Without doing a Table Scan Andy Novick2006-08-21
SQL Server Text Data Manipulation Greg Robidoux2006-07-25
CHECKSUM Functions in SQL Server 2005 Jeremy Kadlec2006-07-19