Curious DTS SQL Task problem -
08-24-2004
, 08:46 AM
We're using SQLServer 2000 (SP3) running on Win2K boxes.
I'm using EM on a Win2K Pro box. I've run across this
little oddity. I have a workaround, but I'm bugged by why
the problem exists in the first place.
I have a DTS SQL Task as follows:
update Information
set LastRunDate = ?
where InformationID = ?
insert into DtsRunErrorLog (
StepName,
ErrorMessage,
RunDate
) VALUES (
'POD Status Repository',
'End',
?
)
The arguments are the package
globals "Today";"InformationID";"Today" (yes,
using "Today" twice). The types of the globals are date,
int, and date. "Today" is assigned a value of "convert(
smalldatetime, getdate())" at the beginning of the
package. Both of the columns Information.LastRunDate &
DtsRunErrorLog.RunDate are datetime (not smalldatetime).
When the above code runs it updates
Information.LastRunDate with the correct date, but the
INSERT to DtsRunErrorLog.RunDate is Today + 2 days *AND*
truncated (date only, no time). The workaround is to
assign the incoming date to a local variable and use that
local in the SQL statements (and take away the
second "Today" in the list of arguments):
declare @foo datetime
set @foo = ?
update Information
set LastRunDate = @foo
where InformationID = ?
insert into DtsRunErrorLog (
StepName,
ErrorMessage,
RunDate
) VALUES (
'POD Status Repository',
'End',
@foo
)
Why in the name of #&$% does this make a difference?
thx
jeff |