Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Delimit values in a column into rows
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 04/27/2013 :  16:17:29  Show Profile  Reply with Quote
I having trouble taking the below type of column and delimiting it into rows. See below:

ID BatchNum
543 455/544/655

ID BatchNum
543 455
543 544
543 655


James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 04/28/2013 :  08:24:09  Show Profile  Reply with Quote
You need a string parser - the best one by far that I have seen is Jeff Moden's code here: Copy the code from Figure 21 in his article to an SSMS query window, and run it - which will install the function. Then use it like this:
	d.Item as BatchNum
	YourTable t
	cross apply
	( select * from  dbo.DelimitedSplit8K( t.BatchNum,'/')) d
order by
	id, ItemNumber;
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 04/29/2013 :  01:00:08  Show Profile  Reply with Quote
just another way

SQL Server MVP
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000