Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Data flow extract with where IN clause

$
0
0

I have a table with 5 rows for locationID , I need to extract the data based on active location.

So when i extract source data , I will be using where IN clause

I did a test by importing below in script task  (full result set)

--  select [locationID] from [location] where [Active] = 1

And then in data flow task used a parameter for where IN clause , which seem to be not achievable.

-- In data flow i used

select * from source_table
Where [location] IN (?)

Am getting error as Description: "Invalid character value for cast specification".

Table details  for understanding -

Create table [location]  
(
[locationID] INT,
[Active] BIT
)

Insert into [location] Values (1 , 1)
Insert into [location] Values (2 , 1)
Insert into [location] Values (3 , 1)
Insert into [location] Values (4 , 0)
Insert into [location] Values (5 , 0)


select [locationID] from [location] where [Active] = 1

select * from source_table
Where [location] IN (?)

I can use for each loop but from performance standpoint this seem to be very optimal..  any advise?


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>