SSIS Expression

Vicki 46 Reputation points
2020-12-08T20:00:53.42+00:00

Hi,

I have the expression task form SSIS and needs to check to see if today's date is the end of the current month.

compare between current date is the last date of the month, but I am not sure how to put all together as the expression

convert(date,DATEADD("d", -DAY(GETDATE()), DATEADD("m", 1, GETDATE()))) =convert(date, getdate())

Thanks

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,591 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Monalv-MSFT 5,901 Reputation points
    2020-12-09T02:37:40.197+00:00

    Hi @Vicki ,

    We can use the following expression in SSIS Expression Task to check if current day is the last day of current month:

    1. If it is, the result will be True.
    2. If it isn't, the result will be False.

    (DT_WSTR, 50)(DT_DBDATE)GETDATE() == (DT_WSTR, 50)(DT_DBDATE)DATEADD("d", -DAY(GETDATE()), DATEADD("m", 1, GETDATE()))

    Please refer to the following pictures:

    46437-expressiontask.png

    46357-getcurrentdate.png

    46438-getlastdayofcurrentmonth.png

    Best Regards,
    Mona

    ----------

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    Hot issues in November--What can I do if my transaction log is full?
    Hot issues in November--How to convert Profiler trace into a SQL Server table?


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.