Share on Facebook

Friday, June 3, 2011

How to Split SQL String to Multiple String using Delimiter

How to check if a text exists within another in SQL Server 2008 / How to split SQL Column based on Comma

You can use the combination of CharIndex and Substring function in SQL to split the string based on delimiter.

Here is a way to split a column based on Comma

Select LTRIM(SUBSTRING(EmpAddress, CHARINDEX( ',',EmpAddress)+1,len(EmpAddress))) from #TempEmployee

We have used Ltrim to remove any leading spaces
Related Posts Plugin for WordPress, Blogger...