Showing posts with label Sql Server. Show all posts
Showing posts with label Sql Server. Show all posts

Friday, June 26, 2009

SUBSTRING() in SQL Server

SELECT 'gangadhar',SUBSTRING('gangadhar', 1, 1)

this query returns the name in one column with only the first initial in the second column.

Output is:
gangadhar g

STUFF in Sql Server 2005

SELECT STUFF('gangadhar', 2, 3, '12345')
The following example returns a character string created by deleting three characters from the first string, gangadhar, starting at position 2, at a, and inserting the second string at the deletion point.
Output :
g12345adhar