May 8, 2011 at 9:25 am
Hi everyone,
Please, some light over my problem...
I´m executing the query:
declare @dir varchar
SET @dir = '4, 2'
SELECT *, empresa FROM DIRETORIAS WHERE (empresa IN (@dir))
The problem is that only the first record is showed "4", if I change to '2, 4' only one record is showed, too, "2".
Thanks in advance. Best
Daniel
May 8, 2011 at 9:46 am
Please don't cross post. It just wastes peoples time and fragments replies.
No replies to this thread please. Direct replies to: http://www.sqlservercentral.com/Forums/Topic1105123-149-1.aspx
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 9, 2011 at 6:50 am
phele table se select karo , fir usmese kaam ki cheeze khich kar nikalo,2bar + 3bar_karo and:hehe: u got ur result:-P:w00t::cool::hehe::-D:-):-P
May 9, 2011 at 9:08 am
You can't use a list in a varchar like this. Use a table instead:
declare @dir table (d varchar)
insert into @dir select '4' union select '2'
SELECT *, empresa FROM #DIRETORIAS WHERE empresa IN (select * FROM @dir)
May 9, 2011 at 11:22 am
Hi kipb-world,
Thank you very much, works fine!
Best,
Daniel
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply