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

 All Forums
 Site Related Forums
 Site Related Discussions
 Script Forum Post Clarification

Author  Topic 

Kristen
Test

22859 Posts

Posted - 2004-07-17 : 12:57:12
I was replying to a post earlier and wanted to advise then to use a "CSV Splitter" UDF that used a TALLY table and went on a little hunt for it, and there ain't one here. I spent hours looking 'coz I was certain it was here. Then I did a Google and blow me the original I started from was written by those sql-performance boys.

But there is a relevant bit on here by His Guruness jcelko.

In fact the sql-performance one is marginally broken.

So I've souped up my Splitter to have parameters for CSVString, Delimiter and "What to return for blank ones".

Can I post it in SCRIPTs if I supply the URL to the sql-performance and jcelko threads?

Kristen

kselvia
Aged Yak Warrior

526 Posts

Posted - 2004-07-17 : 13:50:25
Krisetn, this is one of the best reviews of the techniques I know of.

http://www.sommarskog.se/arrays-in-sql.html

Or another similar review but not quite as thorough;

http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm#top

Is your split faster than the ones in those articles? I'd like to see it if it is. Always interested in faster code.

--Ken
Your Kung-Fu is not strong. -- 'The Core'
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-17 : 14:33:31
Interesting link, thanks.

Mine's more generic, but it uses a TABLE VAR, whereas sommarskog's function is a RETURNS TABLE AS RETURN(SELECT ...) which may be more efficient.

Kristen
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2004-07-20 : 15:14:07
Kristen, is this the sort of CSV Splitter routine you were looking for? http://www.sqlteam.com/item.asp?ItemID=2652

-----------------------------------------------------
Words of Wisdom from AjarnMark, owner of Infoneering
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-20 : 16:54:49
Not quite. There is plenty of learned opinion, but no "Here's a function, just use it". I'd like to point users at a Function, rather than pointing them at another site, but I don't know the ethics of quoting from other sources in order to build something that users can cut&paste to give them an instant-gratification solution.

Kristen
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2004-07-20 : 19:27:16
Well, we certainly don't encourage plagiarism, and we have several links to external sites in the Articles section. Of course, if anyone has a routine that they have created, posting it in our Script Library is encouraged. If you created yours based on things you read from others, a link giving them credit is probably appropriate.

Or you might talk to Graz about writing an article on the subject, perhaps critiquing some of the different approaches that you have seen, with explanations why you do or don't like them.

-----------------------------------------------------
Words of Wisdom from AjarnMark, owner of Infoneering
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-21 : 00:00:16
Thanks Mark, I'll have a crack at something

Kristen
Go to Top of Page
   

- Advertisement -