• sturner (2/20/2013)


    you are running bcp from a shell, so get the current date (M/D/Y) part into a variable:

    set DATEVAR=%DATE:~4,10%

    as part of a filename you probably want to change the / to - like this:

    set mydate=%DATEVAR:/=-%

    then you can use %mydate% in your batch command wherever you want the current date, like today would be: 02-20-2013

    What language are you using? This doesn't appear to be T-SQL.

    Never mind. I get it. These are batch commands at the command line level. Well done.

    Can you think of a way to have the date come out in the ISO format of YYYYMMDD to support sortable file names using the batch commands?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)