Useful SQL Split to Table Functions for CSV

1 Flares Twitter 0 Facebook 0 StumbleUpon 0 Google+ 1 LinkedIn 0 1 Flares ×

Here are a couple of sql functions that I use a lot for handling CSV parameters to stored procs:

Split To Table

The first function splits a delimited string into a table:

This returns a table variable with 2 columns, Part (the delimited part of the string) and PartNumber (the part index). You can use this like this:

split to table int

This function is exactly the same as SplitToTable except that the part column is of type INT, and the parts that get split out are converted to INT:

This is used in exactly the same way!

The Essential App Marketing Kit
Subscribe To My Newsletter To Get an Entire Chapter From The Book for FREE
Never display this again
1 Flares Twitter 0 Facebook 0 StumbleUpon 0 Google+ 1 LinkedIn 0 1 Flares ×