August 9, 2007 at 9:12 am
Hi all,
I need to replace a situation like this:
select x from y where id in (1,2,3,)
where id is an int
with something like this
select x from y where id in (select id_values from z)
where id_values is a varchar that has a comma delimited string of ids so it looks like this '1,2,3'
I'm getting the Syntax error converting the varchar value.. msg
I know the test_expression (y) needs to be the same data type as the values in the comma seperated list but since that has to be a string data type I'm stumped.
August 9, 2007 at 9:23 am
Look here ...
http://www.sqlservercentral.com/scripts/viewscript.asp?scriptid=835
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgAugust 9, 2007 at 10:39 am
Thanks so much, works great!
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply