Is there a way to join tables on one field that represents a series of valid values? For example, one table has a number or string with "51234" and the other has something like "46610..46680|48670|50000..54280|48240". If there isn't a way to directly join these, is there a way to convert that series to rows with each number in it for a table variable or something like that?
That series column is being generated from Dynamics Nav 5.0 SP1 for general ledger accounts being mapped to departments. I have very little experience with that system, and a LOT of what we have was customizations that a third party was contracted to do, so that may or may not even be standard... I don't even have direct access to the database for that either, but as far as I can tell, that series is being stored as a varchar(100).
I've searched around a lot, but I haven't seen anything like what I need to do. Hopefully someone here has some ideas..
Firstly, that's poor database design so shame on Dynamics Nav or your 3rd party contractor they should know better. You can join tables on columns that are stored like that.
It may be possible to construct a LIKE clause that works for you
t1 JOIN t2 ON t1.id LIKE ('%' + t2.id + '%')
So if t1 Were '46610|46680|50000|' and t2 Were 46680 this would be a match. However, this will quickly get unruly and may be difficult to accomplish exactly what you are trying to do.
Your best bet is to normalize the data. Which is doing exactly what you suggested and breaking out each of the values into their own row. While there is no internal 'split' function that will accomplish this. Here is an SO post about split for sql server : link.
Honestly, though this sounds like a problem that may be beyond your ability to handle (no direct access to DB). I would suggest hiring someone to re-write this to create normalized data in the first place or requesting whomever does have access to fix this process.