|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 7:51 PM
Points: 32,910,
Visits: 26,800
|
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, February 15, 2013 7:51 AM
Points: 53,
Visits: 85
|
|
using this with more than 100 rows with the recursive option set to 0, makes it slower that using the while version of it
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, April 24, 2013 7:45 AM
Points: 4,
Visits: 77
|
|
msaleem-583379 has a pretty good function. I modified it to return varchar instead of int values. As such, it needed a couple of improvements:
1. Empty strings or spaces on either side of a comma returned a row, but emtpy string or spaces with no comma returned no rows, which is inconsistent. I made it return one row with an emtpy string when receiving an empty string for input. (NULL still returns 0 rows.)
2. If last item in input was spaces, it returned empty string; in other positions, the spaces were returned. I made it return all spaces in last item.
These changes required:
a. Removing "Or Len(@csv) = 0" from the first IF.
b. Getting the full length of the input with "@RealLength = len(@csv + 'x') - 1" and using @RealLength instead of len(@csv) in the final SELECT.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 7:51 PM
Points: 32,910,
Visits: 26,800
|
|
phickey (5/13/2011) msaleem-583379 has a pretty good function.
Where is that? What is the URL? I don't see such an entry on this thread.
And, for the record, the "performance issue" with the Tally Table has very successfully been put to bed for VARCHAR(8000) and NVARCHAR(4000). Please see the following article... http://www.sqlservercentral.com/articles/Tally+Table/72993/
And, yes, I realize I'm responding to a post that is responding to a two year old thread.
--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."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|