Glowworm27
Programmer
Hello all,
I have an ssis package that retrieves records from a table based on a datetime field. I also have a table that keeps track of the max(datetime) stamp of the records so that the next time my code is run it gets the next set of records.
However what seems to be happening is the comparison code is not checking down to the millisecond and I am getting duplicate records on the following run.? Like the last record from day one, is the first record to be sent on day two.
To retrieve the records I do something like this...
First I get the last datetime stamp into a ssis datetime variable using the follwing SQL, and set the resultset to singlerow, and store the result in the "lastDatetime" variable
I then retrieve the records from the main table where the Create_date is greater than the variable "lastDateTime"
where the ? parameter is set to the package variable "lastdateTime"
Then I will export these records into a flat file and they get ftp'd somewhere. After these records get exported I then update the historytable with the following
my question is when the records are compared to the package variable, or during the Max(Create_date) function does SQL compare this down to the millisecond?????
thanks for any insight you may be able to provide
G
George Oakes
CEO & President
COPS Software, Inc.
Programmer & Developer
.Net, WSS 3.0, SQL DBA
Check out this awsome .Net Resource!
I have an ssis package that retrieves records from a table based on a datetime field. I also have a table that keeps track of the max(datetime) stamp of the records so that the next time my code is run it gets the next set of records.
However what seems to be happening is the comparison code is not checking down to the millisecond and I am getting duplicate records on the following run.? Like the last record from day one, is the first record to be sent on day two.
To retrieve the records I do something like this...
First I get the last datetime stamp into a ssis datetime variable using the follwing SQL, and set the resultset to singlerow, and store the result in the "lastDatetime" variable
Code:
(select max(DateCreated) as maxdate from historytable where process = 'daily export' )
I then retrieve the records from the main table where the Create_date is greater than the variable "lastDateTime"
Code:
Insert into temptable
Select * from maintable where Create_date > ?
Then I will export these records into a flat file and they get ftp'd somewhere. After these records get exported I then update the historytable with the following
Code:
Update historytable set DateCreated = (Select Max(Create_date) from temptable)
where process = 'daily export'
my question is when the records are compared to the package variable, or during the Max(Create_date) function does SQL compare this down to the millisecond?????
thanks for any insight you may be able to provide
G
George Oakes
CEO & President
COPS Software, Inc.
Programmer & Developer
.Net, WSS 3.0, SQL DBA
Check out this awsome .Net Resource!