Monday, June 14, 2010

SUBSTRING in SQL server

Get substring (piece of string) in SQL server.

DECLARE @Temp AS VARCHAR(100)

SELECT @Temp = 'I am part one.I am part two.'

SELECT SUBSTRING(@Temp,1,14)

SELECT SUBSTRING(@Temp,15,CHARINDEX('.',@Temp))

No comments:

Post a Comment