Using global variable in DTS

  • Hi everyone,

    I have a problem.

    Using DTS I created an Execute SQL task that queries an SQL Server table for the maximum activity date and puts this date in a global variable. Then I use that value in the global variable in a Transform Data task to query the Oracle table by writing a script that says:

    select * from Oracle_table where activity_date > ?

    ? refers to the global variable

    This fails when I try to reference the global variable.

    It works when the Transform data task is used to transfer data b/n two SQL Server databases

    Thanks

    Henok


    Henok

  • Henok,

    I didn't want a day to go by without letting you know someone was looking into your issue. Fridays can get a bit crazy, but one of us should get you some info tonight. Let us know if you figure it out before we do!

    Sean

  • In what manner does the task fail? Does it produce an error, or does it just not return the correct results (you were expecting to get ten records, but it gave you none - or twenty)?

  • Hi Sean,

    Thanks very much for your quick reply. I am sorry for not getting back to you on time. Here's the problem: I am able to create a global variable and assign a date value to it in an Execute SQL task. Then I create the Transform Data task that copies data from an Oracle table to the SQL Server table. The 'source' tab in the Transform data task contains the script to run against the Oracle database. When typing the sql script in the Source tab of the Transform Data task, I should be able to hit the 'parameters' button to select an input global variable (the same variable to which I assigned a date value earlier). But clicking on the parameters button gives me an error. So the problem is that I am not even able to select an input parameter for my query that is to be run in the source tab.

    Thanks for your help!

    Henok


    Henok

  • Sean,

    Here's the sql script in the source tab:

    select * from Oracle_table where activity_date > TO_DATE(?, 'DD/MM/YYYY')

    TO_DATE() is an oracle function that I use to format the date from the input parameter.

    Here is the error message:

    Hresult of 0x80040e51 (-2147217839) returned

    Unexpected error occured. An error result was returned without an error message

    Henok

    Henok


    Henok

  • Have you tried the sql statement without the TO_DATE function included? At first glance, I would bet that is at least part of your problem. I'll try and re-create the error here later today.

    Sean

  • Sean,

    I have tried it without the TO_DATE function. I still get an error. Were you able to recreate the error?

    Thanks for your help!

    Henok

    Henok


    Henok

  • When you tried: select * from Oracle_table where activity_date >?

    Did you get the same error message or a different one. I can not try to recreate your problem because I do not have an oracle database but I was able to do the same type of opperation between two microsoft sql server databases.

  • Leon,

    My package works when the source and destination databases are SQL Server databases. When I change the source database to an Oracle database, then the query for the source database refuses to recognize the input parameter (which is the global variable set in a previous task).

    I appreciate your help.

    Henok


    Henok

  • The error message is the same when I just type

    select * from Oracle_table where activity_date > ?

    Also, when I hit the preview button to see the result set I get the following error message:

    HResult of 0x80040e10(-2147217904) returned

    Unexpected error occured. An error result was returned without an error message.

    Henok


    Henok

  • I'm still working on getting an oracle DB on my test server. Have you tried to run this with the date hard coded, and see what you get?

    Just found this on the KB:

    http://support.microsoft.com/support/kb/articles/Q240/2/05.ASP

    Hmmmmmmm...

  • found this for "debugging hresults for ole-db":

    0x80040E10 -2147217904 No value given for one or more required parameters

    http://support.microsoft.com/support/kb/articles/Q168/3/54.asp

  • and this one for your previous error (same url):

    0x80040E51 -2147217839 The provider cannot derive parameter info and SetParameterInfo has not been called

  • Thanks for you help Sean!

    The first links were helpful!

    I changed the source database connection to Microsoft ODBC for oracle and now I am able to refer to the global variable set in a previous task. But the query still doesn't run. I am one step closer though. I get the following error when executing the piece:

    0x80040E10 -2147217904

    When I hard code an actual value for the date it actually works just fine.

    Thanks for your help! Kindly let me know if you find out anything.

    Henok


    Henok

  • I'll run a few more tests. Let us know if you figure it out, or come up with any work-arounds.

Viewing 15 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic. Login to reply