results of a sql command in a dts global variable -
05-18-2004
, 04:11 PM
I need to assign a couple global variables some information that would be
determined through a set of sql commands.
the 3 I have to have are a date & time, and a summed amount.
I have to grab info from 2 tables, grab everything from the first, and grab
only matching records from the 2nd, and then create a summed amount of the
money values on the 2nd table and stick that into a global variable to use
inside a DTS job.
Second one is date & time, but I need to remove the formatting . For
instance, 05/15/2004 would be 20040515 and 15:05:34 would be 150534.
The SQL to do these is here:
DECLARE @curDate As DateTime
DECLARE @curTime As DateTime
SET @curDate = GetDate()
SET @curTime = GetDate()
declare @charDate as char(8)
declare @charTime as char(8)
set @chardate = convert(char(8),@curDate,112)
set @charTime = STUFF(STUFF(convert(char(8),@curTime,114),3,1,''), 5,1,'')
I need to set what I have in @chardate & @chartime to 2 global variables
that'd be able to be referenced throughout the rest of the DTS job.
I can find some examples where you set global variables to be constants or
plain old assigning values to it, but not where they're set to the results
of a SQL command.
Any help/advice appreciated.
SC |