I'm searching a field in a table that contains commas. The field contains sales ids and it it's stores in this format: 267,549,496. This web app was created a long time ago and I've been tasked with maintaining it, lucky me. What i'd like to do is normalize the whole thing but that would be more work than I'd like to put into it so where's the thing. When someone enters a new sales ID I have to make sure it doesn't already exist before I insert it.
I have a udf that will split on a character but I can't do a join and pass the Sales ID field into my function and return a table, or if someone can tell me how I'd appreciate that.
Can someone give me any idea on how I can do this? I'd like to do this in a stored procedure where I accept the SID parameter, if it is comma separated i'd obviously have to split that but I still have the dilemma of the data in the table.
If anyone has a solution for me I'd greatly appreciate it...
Thank you.
↧