Can I configure SSIS Package as regular Job with default date input and also explicit date input on demand

Arjun 1 Reputation point
2022-08-18T11:04:54.75+00:00

Can I configure SSIS Package as regular Job like this default it should take getdate-1 (previous date) ths one I am already doing it but whenever its failed for some reasons on some days I want to re Run it with giving particualr date input and run it again is this possible with single package deployment ? Ii thought to make it 2 copies one for regular default run with getdate-1 and another package with date input ..which is the best suggestion ..pls help ?

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,705 questions
SQL Server | Other
{count} votes

2 answers

Sort by: Most helpful
  1. Yitzhak Khabinsky 26,586 Reputation points
    2022-08-18T12:24:57.083+00:00

    Hi @Arjun ,

    You can use a package parameter, let's say Package::DateParameter.
    By default, SSIS assigns a default value as "1899-12-30 00:00:00.000" and passes the default value as the parameter rather than the null value.

    Inside the SSIS package you can use the following expression:

    $Package::DateParameter == (DT_DATE)"1899-12-30" ? DATEADD("Day",-1,GETDATE()) : $Package::DateParameter)  
    

    For the reference: conditional-ssis-expression

    1 person found this answer helpful.
    0 comments No comments

  2. ZoeHui-MSFT 41,496 Reputation points
    2022-08-19T07:13:30.617+00:00

    Hi @Arjun ,

    If you want to read system date value and create output based on current date, you can use expression with GETDATE() function.

    If you want to have date dynamically which you can set it from outside (sql server job or any other place), create package variable for date and then you can pass this variable value with DTEXEC command line.

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.