question

krakenfromthesea avatar image
krakenfromthesea asked

Matching a column entry to

Column 1 of my table contains a list of names. In my database I have a file that has the name listed in the column. I want to "read" the list of names from column 1, and then open the file with the same name. For example, let's say Column 1 is 1.Apple 2.Banana 3.Strawberry I want to "read" Apple, then find and access the columns in the file named Apple.csv. I'm essentially looking for something along the lines of string-matching in SQL.
querystring
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Grant Fritchey avatar image
Grant Fritchey answered
I'd suggest you look into using a tally table to break up the list of names in the first column into a table. You can probably pack that into a CTE. [Here's an article][1] outlining how to do this. [Here's another][2], written by my favorite T-SQL genius, Jeff Moden. [1]: http://www.sqlservercentral.com/blogs/rocks/2012/02/07/convert-comma-separated-string-to-table-and-vice-versa/ [2]: http://www.sqlservercentral.com/articles/T-SQL/62867/
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.