SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Tally OH! An Improved SQL 8K “CSV Splitter” Function


Tally OH! An Improved SQL 8K “CSV Splitter” Function

Author
Message
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)

Group: General Forum Members
Points: 432907 Visits: 43494
Comments posted to this topic are about the item Tally OH! An Improved SQL 8K “CSV Splitter” Function

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
WayneS
WayneS
SSC-Forever
SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)

Group: General Forum Members
Points: 42231 Visits: 10794
Jeff, I had to rate this article 5 stars, because that's as high as the ratings allow. It deserves a 15!

BTW, I'm aghast --- you've actually used a SQL CLR now! :-D It would be nice if we could get Paul to contribute it, and to have it added to the resources of this article.

Again, excellent job. Extremely well done, and extremely thorough. Thank you so much for this article, and for the new DelimitedSplit8K function.

Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings

Evil Kraig F
Evil Kraig F
SSC-Forever
SSC-Forever (44K reputation)SSC-Forever (44K reputation)SSC-Forever (44K reputation)SSC-Forever (44K reputation)SSC-Forever (44K reputation)SSC-Forever (44K reputation)SSC-Forever (44K reputation)SSC-Forever (44K reputation)

Group: General Forum Members
Points: 44557 Visits: 7660
Thanks Jeff. It's great to walk with you through your beer-popsicle thought process, and for all the work you did here.

I thought I was the only one who would sit in the corner with the dust bunnies.... :-)

I still want to shoot CLR though.


- Craig Farrell

Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

For better assistance in answering your questions | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)

Group: General Forum Members
Points: 432907 Visits: 43494
WayneS (5/1/2011)
Jeff, I had to rate this article 5 stars, because that's as high as the ratings allow. It deserves a 15!

BTW, I'm aghast --- you've actually used a SQL CLR now! :-D It would be nice if we could get Paul to contribute it, and to have it added to the resources of this article.

Again, excellent job. Extremely well done, and extremely thorough. Thank you so much for this article, and for the new DelimitedSplit8K function.


I couldn't have done it without the help of you, Ron, and Paul. All 3 of you did some awesome work with testing and verification of the code. You guys ROCK!

So far as the CLR goes... yeah, I know I stuck my toe into the other world, but I had to know if the new function even came close. Paul was very cool in his understanding that I don't even know how to spell "C" and he made it real easy for me to install. :-)

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)

Group: General Forum Members
Points: 432907 Visits: 43494
Craig Farrell (5/1/2011)
Thanks Jeff. It's great to walk with you through your beer-popsicle thought process, and for all the work you did here.

I thought I was the only one who would sit in the corner with the dust bunnies.... :-)

I still want to shoot CLR though.


Heh... dust bunnies know so much! :-P Thanks for the feedback, Craig.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
bitbucket-25253
bitbucket-25253
SSC-Dedicated
SSC-Dedicated (30K reputation)SSC-Dedicated (30K reputation)SSC-Dedicated (30K reputation)SSC-Dedicated (30K reputation)SSC-Dedicated (30K reputation)SSC-Dedicated (30K reputation)SSC-Dedicated (30K reputation)SSC-Dedicated (30K reputation)

Group: General Forum Members
Points: 30039 Visits: 25280
WayneS (5/1/2011)
Jeff, I had to rate this article 5 stars, because that's as high as the ratings allow. It deserves a 15!

BTW, I'm aghast --- you've actually used a SQL CLR now! :-D It would be nice if we could get Paul to contribute it, and to have it added to the resources of this article.

Again, excellent job. Extremely well done, and extremely thorough. Thank you so much for this article, and for the new DelimitedSplit8K function.


Jeff let me second WayneS statement.... and add it was an honor and privilege to work for you on the testing.

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)SSC Guru (432K reputation)

Group: General Forum Members
Points: 432907 Visits: 43494
bitbucket-25253 (5/1/2011)
WayneS (5/1/2011)
Jeff, I had to rate this article 5 stars, because that's as high as the ratings allow. It deserves a 15!

BTW, I'm aghast --- you've actually used a SQL CLR now! :-D It would be nice if we could get Paul to contribute it, and to have it added to the resources of this article.

Again, excellent job. Extremely well done, and extremely thorough. Thank you so much for this article, and for the new DelimitedSplit8K function.


Jeff let me second WayneS statement.... and add it was an honor and privilege to work for you on the testing.


Thanks for all the help testing, Ron. You did a great job. Heh... and no dust bunnies where actually injured during any of the tests. :-D

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Solomon Rutzky
Solomon Rutzky
SSCertifiable
SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)

Group: General Forum Members
Points: 6083 Visits: 3084
Very thorough analysis. Great job!

Take care,
Solomon...

SQL# - https://SQLsharp.com/
Sql Quantum Lift - https://SqlQuantumLift.com/
Abrar Ahmad_
Abrar Ahmad_
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1742 Visits: 1326
Solomon Rutzky (5/1/2011)
Very thorough analysis. Great job!

Take care,
Solomon...


But it seems at least a week long activity !!!
:-P

Goodish!

David Data
David Data
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1589 Visits: 828
All these methods use CHARINDEX to efficiently see where the next delimiter is. But what about handling CSV strings with quoted text, e.g. where "John Smith","23, The High Street","Sometown" has to be split into 3 strings? Do you have a good method for this sort of data?

(This is why I prefer tab separated to comma separated, with all its different ways to handle embedded comas, but usually you have to process the client's data as they give it to you, not as you'd like it Rolleyes )
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search