Search This Blog

Tuesday, April 2, 2013

SUBSTRING SQL Server

SQL Server > Built-in Functions > Substring

SUBSTRING SQL Server returns part of a string

Syntax:

SUBSTRING ( expression ,start , length )

Example:

declare @str varchar(10) = '08.12.2013'
select substring(@str,1,2) as day, substring(@str,4,2) as month, substring(@str,7,4) as year

Result:
day month year
08  12    2013