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.
Author |
Topic |
delpiero
Yak Posting Veteran
98 Posts |
Posted - 2005-08-10 : 23:11:21
|
Hi all, I am quite new to DTS and now I have 2 questions on my new DTS package, which is used to retrieve the past day's records in the audit table and transfer these records to the destination database. Suppose I have an "Transform Data Task" which selects records from a query and transfers the data to the destination (Visual Foxpro database via ODBC). The select query is similar to this: select * from "dbo"."USERDB"."AUDIT_LOG" where changedon > dateadd(day, -1, ? ) . Actually what I want to do is to make the parameter "?" a "getdate()" default value. When I defined a global variable for the parameter, I assigned a "TODATE" variable, with type "date", and value "28-07-2005". It doesn't seem I can put the function "getdate()" into the value field. (1) I tried to run the package by dtsrun utility so that I can pass a value for the global variable "TODATE": dtsrun /SMYSERVER /E /n"EXPORT_AUDIT_RECORDS" /aTODATE:7='05-08-2005' The package ran successfully without any errors. But I found that it still used the parameter value at design time, i.e. 28-07-2005, and not the one I passed in at run time, 05-08-2005. Is there anything I specified incorrectly in my command?(2) In my dateadd(day, -1, ?) function, suppose I also want the 2nd argument of dateadd to be a variable passed in by parameter. I typed dateadd(day, ?, ?)Then I created a global variable INCREMENT, with type integer, and value 1 (or -1). I assigned it as the first parameter in my SQL query. But when I parsed the query, it prompts an error: Argument data type datetime is invalid for argument 2 of dateadd function." Even if I just used INCREMENT as the only parameter in my query (i.e., removed the 2nd question mark), the result is the same. Does anyone know what the problem is?Lots of thanks,delpiero |
|
delpiero
Yak Posting Veteran
98 Posts |
Posted - 2005-08-10 : 23:44:36
|
Hi all, I think I have solved my first question as I was not aware that the global variable name is CASE-SENSITIVE in the dtsrun utility and I think I typed the wrong case. But question 2 is still under investigation ...delpiero |
 |
|
surme
Starting Member
2 Posts |
Posted - 2005-08-17 : 04:36:50
|
quote: Originally posted by delpiero Hi all, I am quite new to DTS and now I have 2 questions on my new DTS package, which is used to retrieve the past day's records in the audit table and transfer these records to the destination database. Suppose I have an "Transform Data Task" which selects records from a query and transfers the data to the destination (Visual Foxpro database via ODBC). The select query is similar to this: select * from "dbo"."USERDB"."AUDIT_LOG" where changedon > dateadd(day, -1, ? ) . Actually what I want to do is to make the parameter "?" a "getdate()" default value. When I defined a global variable for the parameter, I assigned a "TODATE" variable, with type "date", and value "28-07-2005". It doesn't seem I can put the function "getdate()" into the value field. (1) I tried to run the package by dtsrun utility so that I can pass a value for the global variable "TODATE": dtsrun /SMYSERVER /E /n"EXPORT_AUDIT_RECORDS" /aTODATE:7='05-08-2005' The package ran successfully without any errors. But I found that it still used the parameter value at design time, i.e. 28-07-2005, and not the one I passed in at run time, 05-08-2005. Is there anything I specified incorrectly in my command?(2) In my dateadd(day, -1, ?) function, suppose I also want the 2nd argument of dateadd to be a variable passed in by parameter. I typed dateadd(day, ?, ?)Then I created a global variable INCREMENT, with type integer, and value 1 (or -1). I assigned it as the first parameter in my SQL query. But when I parsed the query, it prompts an error: Argument data type datetime is invalid for argument 2 of dateadd function." Even if I just used INCREMENT as the only parameter in my query (i.e., removed the 2nd question mark), the result is the same. Does anyone know what the problem is?Lots of thanks,delpiero
|
 |
|
surme
Starting Member
2 Posts |
Posted - 2005-08-17 : 04:39:58
|
Hi, Mr.Please told me, how did you do to resolve this problem?I have the same problem...please, explain me what happen at all...regards,Surme.- |
 |
|
delpiero
Yak Posting Veteran
98 Posts |
Posted - 2005-08-25 : 06:36:53
|
dtsrun /SMYSERVER /E /n"EXPORT_AUDIT_RECORDS" /aTODATE:7='05-08-2005' My previous problem was that the DTS package name EXPORT_AUDIT_RECORDS" is case-sensitive, i.e., I must type in exactly the same case as the original case of the DTS package, otherwise the dtsrun would fail.Best regards,delpiero |
 |
|
|
|
|
|
|