Search code examples
ssisssis-2012

SSIS when using getdate is there a way to remove miliseconds?


I am new to ssis. I'd say an intermediate beginner :)

Is there a way to remove miliseconds from getdate()?

I.e. if the getdate() function returned

2018-10-10 18:31:45.924000

, I'd want to remove the

.924000

.

Edit:

I will be including this in the file name at the end.


Solution

  • The data always comes in this format:

    yyyy-MM-dd hh:mm:ss.SSSSSS

    Instead of trying to remove the miliseconds, I just grabbed the first 19 characters with the left function.

    Problem solved.

    Edit:

    Here is the expression that I used:

    left((DT_WSTR, 4000) GETDATE(),19)