|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 6:10 AM
Points: 313,
Visits: 168
|
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, May 02, 2013 9:10 PM
Points: 26,
Visits: 263
|
|
Excellent! I have two other procs that do this but not with such elegance. i will be testing performance of the three versions soon and will add findings. The other versions also return only strings. I did have to add one more single quote at the end to make it work.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 5:50 PM
Points: 1,308,
Visits: 3,899
|
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Thursday, December 20, 2012 1:03 PM
Points: 265,
Visits: 589
|
|
Good parsing technique.
Even though @strDataSet is declared as max, aren't the procedure parameters limited to max length of only 128 characters? That limits the longest string that can be parsed to that limit. Right?
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: 2 days ago @ 7:46 AM
Points: 31,
Visits: 503
|
|
| This is clever and a little more flexible than some of the other techniques - and useful if all you need to do is return the output directly to the caller. But the weakness is that the dynamic SQL means it can't be moved to a function - using a procedure really limits what you can do with the output. I've had very good results that use a table-valued function and a numbers table to parse lists, and then the TVF results can be used in JOINs and other structs, unlike the output of a stored procedure (which can only be dumped to a temp table if further processing or filtering is required).
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, September 06, 2012 4:11 AM
Points: 2,
Visits: 8
|
|
Is the script correct? When I run it, I got an "Unclosed quotation mark after the character string '" error message. So I commented out the last + ' (that before the EXEC(@STR) statement) and could create the stored procedure. After the fix, the stored procedure seems to work fine. Best regards
|
|
|
|