dbTalk Databases Forums  

Curious DTS SQL Task problem

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


Discuss Curious DTS SQL Task problem in the microsoft.public.sqlserver.dts forum.



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

Default 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


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.