Wednesday, April 13, 2011

Separate Strings in SQL Server

During my Development i found a situation where i have to separate string on '|' basis  for acheiving this i wrote following small query


select
SUBSTRING(('KHI|108'),0,CHARINDEX('|',('KHI|108'))) City ,
REVERSE(SUBSTRING(REVERSE('KHI|108'),0,CHARINDEX('|',REVERSE('KHI|108')))) CityCode

No comments:

Post a Comment

Postman beginner Tutorial

Hi , I have started new video series of postman tutorial hope it will be helpful:Please give me your feed back in comments and like and sub...