dbTalk Databases Forums  

Parameterised Query vs LookUps

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


Discuss Parameterised Query vs LookUps in the microsoft.public.sqlserver.dts forum.



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

Default Parameterised Query vs LookUps - 07-19-2005 , 05:30 AM






Hi,

I have a Transform Data Tasks which I'm using to load data from an Oracle DB
into a SQL Server DB. The data in Oracle is for all time periods but I want
to filter for a specific day, this day is not known in advance but can be
derived from a UDF in the SQL Server DB.

Pseudo code
Select * From OracleDB Where TransactionDate = Result of UDF

What is the best way to achieve this?

I cannot use the results of the UDF in the SQL Query because the connection
being used is the Oracle one so it doesn't understand this. I have read that
you can execute a look up against a diff connection and use this but i've
been unable to get this to work.

Essentially I need to execute this UDF to get my selected date and then use
this in the where clause to filter.

Thanks
N

Reply With Quote
  #2  
Old   
Andy S.
 
Posts: n/a

Default Re: Parameterised Query vs LookUps - 07-19-2005 , 10:31 AM






You could create a global variable in the package to store the code for your
SELECT, then use a Dynamic Properties task to assign it to the Data
Transform task. Then you can build the SQL statement with an ActiveX
script.

http://www.sqldts.com has some good examples.

"Neil" <Neil (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi,

I have a Transform Data Tasks which I'm using to load data from an Oracle
DB
into a SQL Server DB. The data in Oracle is for all time periods but I
want
to filter for a specific day, this day is not known in advance but can be
derived from a UDF in the SQL Server DB.

Pseudo code
Select * From OracleDB Where TransactionDate = Result of UDF

What is the best way to achieve this?

I cannot use the results of the UDF in the SQL Query because the
connection
being used is the Oracle one so it doesn't understand this. I have read
that
you can execute a look up against a diff connection and use this but i've
been unable to get this to work.

Essentially I need to execute this UDF to get my selected date and then
use
this in the where clause to filter.

Thanks
N



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

Default Re: Parameterised Query vs LookUps - 07-19-2005 , 11:27 AM



Thanks Andy,

What I've ended up doing is creating a GlobalVariable and setting its value
via the Dynamic Properties task. My Data Transform then uses parameters to
access this global variable.

Personally I think this is a bit convoluted and I would like to keep all the
logic inside the Transform task but it doesn't look like this is possible. I
thought the lookups might give me the option to look this value up
dynamically and pass it too the where clause in my query but it seems that
its not really designed for this. Lookups appear to use the data from the
initial query as the input to the lookup whereas I want the opposite...

"Andy S." wrote:

Quote:
You could create a global variable in the package to store the code for your
SELECT, then use a Dynamic Properties task to assign it to the Data
Transform task. Then you can build the SQL statement with an ActiveX
script.

http://www.sqldts.com has some good examples.

"Neil" <Neil (AT) discussions (DOT) microsoft.com> wrote in message
news:1BEEE5D3-0F09-4009-99DB-1034F790D005 (AT) microsoft (DOT) com...
Hi,

I have a Transform Data Tasks which I'm using to load data from an Oracle
DB
into a SQL Server DB. The data in Oracle is for all time periods but I
want
to filter for a specific day, this day is not known in advance but can be
derived from a UDF in the SQL Server DB.

Pseudo code
Select * From OracleDB Where TransactionDate = Result of UDF

What is the best way to achieve this?

I cannot use the results of the UDF in the SQL Query because the
connection
being used is the Oracle one so it doesn't understand this. I have read
that
you can execute a look up against a diff connection and use this but i've
been unable to get this to work.

Essentially I need to execute this UDF to get my selected date and then
use
this in the where clause to filter.

Thanks
N




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.