Load data for yesterday's date and specific date

  • Hi All,

    I have a ssis package, which runs on date parameter. If we dont specify the date it always load data for yesterday's date. And if we give any specific date like '2015-05-10', It should load for that date. How can we achieve this dynamically (using package configuration)? Once we load for any specific date, package should be set for yesterday's date dynamivally. Please guide me to achieve this as I am new to SSIS.

    Thanks in advance

  • Well I'm no SSIS expert but assuming you have a stored procedure as your data source you could do something like this.

    CREATE PROCEDURE DefaultTest

    @date_param DATETIME = NULL

    AS

    SET NOCOUNT ON

    DECLARE @date DATETIME

    IF @date_param IS NULL

    BEGIN

    SET @date = GETDATE()-1

    END

    ELSE

    SET @date = @date_param

    SELECT @date


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • I'd do it as YB mentioned, but using SSIS. You have your parameter and a variable that should work as an expression where you use conditional (condition?true:false) to evaluate if your parameter is empty or has a valid date.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply