Domanda

My SSIS package has an execute SQL task which has a query that needs a datetime filter at runtime.

The value of this filter is supposed to be the last datetime in which the package ran successfully.

What is the standard/optimal methodology to retrieve, persist and use this lastrun datetime?

È stato utile?

Soluzione

For that kind of thing, I have a "config" table in the database to store the value. Then this can be read and updated each time the package runs. You could also use a text file, but that is not as secure.

Edit:

I achieve this by invoking a SQL Task at the end of the Package that calls a stored procedure. This SP accepts a bit parameter indicating success (1) or failure (0). The SP uses GetDate() to record the time that the Proc ran (which is when the Package finishes).

enter image description here

Altri suggerimenti

As DeanOC posted, I always have a step in my package that stores this kind of stuff. It can be as simple as a insert select current timestamp... kind of thing. or it may be the max of a timestamp column in the data I'm processing, so that next run I can filter by ...> StoredMaxTimestamp.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top