dbTalk Databases Forums  

SSIS- PARAMETERS IN SUBQUERY

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss SSIS- PARAMETERS IN SUBQUERY in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
nirk
 
Posts: n/a

Default SSIS- PARAMETERS IN SUBQUERY - 01-29-2006 , 08:16 AM






Hi,

I'm using ssis 2005 - I'm trying to create an ole db coomand which uses
parameters in sub-qyery:

SELECT vwContactInteraction.iContactID,
vwContactInteraction.iInteractionID, 1 AS iSiteID
FROM nice_interactions.dbo.vwContactInteraction AS
vwContactInteraction
WHERE (vwContactInteraction.iContactID IN
(SELECT TOP (100000) WITH TIES iContactID
FROM nice_interactions.dbo.vwContact
WHERE (dtModifyDate > ?) AND (dtModifyDate
<= ?)
ORDER BY dtModifyDate))

Is there a way to do it - I'm keep getting the "Parameter information cannot
be derived from SQL Statment" ????

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: SSIS- PARAMETERS IN SUBQUERY - 01-29-2006 , 08:40 AM






Hello nirk,


The problem will no doubt still be the fact that the design time interface
is confused by placing the ? placeholders within a subquery. There is an
easy way around this though and it is more elegant than that we have in DTS
2000. You can create an Expression that maps to the SQLStatementSource property
of the task. This will allow you to use your variables. It also has a validation
window that will let you know what the string looks like before running the
task itself.


Allan

Quote:
Hi,

I'm using ssis 2005 - I'm trying to create an ole db coomand which
uses parameters in sub-qyery:

SELECT vwContactInteraction.iContactID,
vwContactInteraction.iInteractionID, 1 AS iSiteID
FROM nice_interactions.dbo.vwContactInteraction AS
vwContactInteraction
WHERE (vwContactInteraction.iContactID IN
(SELECT TOP (100000) WITH TIES
iContactID
FROM
nice_interactions.dbo.vwContact
WHERE (dtModifyDate > ?) AND
(dtModifyDate
= ?)
ORDER BY dtModifyDate))
Is there a way to do it - I'm keep getting the "Parameter information
cannot be derived from SQL Statment" ????




Reply With Quote
  #3  
Old   
pxiong
 
Posts: n/a

Default Re: SSIS- PARAMETERS IN SUBQUERY - 02-08-2006 , 12:55 PM



The way I do mine to bypass the subquery issue is to declare new
parameters and set them you your variables like so:

declare @parm1 int

Set @parm1 = @Var1

Select *
Quote:
From table1
Where parm1 in
(Select Parm1
From table2
Where parm1 = @parm1)

Doing so would allow you to use your package variables in a subquery.
Hope this helps
Philip



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.