Tag Archives: string handling

String interpolation in T-SQL

Most programming languages have the ability to interpolate formatted strings. For example, in C#

1
String input = String.Format("oh hi {0}", "mike");

 

This is also possible in T-SQL through the use of two functions.
In SQL Server 2008 the function xp_sprintf was introduced

Also, in SQL Server 2012 the FORMATMESSAGE function was added.

Advertisements