Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Using array with IN() Function

Author  Topic 

fpendino
Starting Member

5 Posts

Posted - 2010-05-27 : 13:25:06
Hi, I'm trying to using a formatted array with an IN() function for a where criteria.

Here's what the array would look like.

DECLARE @QueueArray varchar(300)

SELECT @QueueArray = Queues
FROM @tmpQueRemoveProcess
WHERE ROW = @Counter

--@QueueArray data could be like ('501', '501R')
-- Here's how I use the array.

UPDATE tblQueues
SET IncentiveEmpPID = 'na', ProductivityEmpPID = 'na'
WHERE Queue IN(@QueueArray)


Shouldn't this work the way I have this setup for using that "string array"?

Thanks,
Frank

fpendino
Starting Member

5 Posts

Posted - 2010-05-27 : 13:36:39
Ok, I think I found the answer to my question. I guess I need to use a table-valued paramter, which I'm familiar with, but why if I pass this varchar string that is formatted with a single quote around the value and a comma to separate, won't this work?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-27 : 13:45:55
quote:
Originally posted by fpendino

Ok, I think I found the answer to my question. I guess I need to use a table-valued paramter, which I'm familiar with, but why if I pass this varchar string that is formatted with a single quote around the value and a comma to separate, won't this work?


Becuase all values seperated by delimiter will be treated as a single value

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -