SQL procedure put today's date to the file namesql server convert date to string MM/DD/YYYYHow to return only the Date from a SQL Server DateTime datatypeHow to check whether an object is a date?Insert results of a stored procedure into a temporary tableWhere can I find documentation on formatting a date in JavaScript?Function vs. Stored Procedure in SQL ServerFind all tables containing column with specified name - MS SQL ServerSearch text in stored procedure in SQL ServerPossible to put today's date as an alias?How to import an SQL file using the command line in MySQL?How to get today's date with pandas?

"Best practices" for formulating MIPs

Is my background sufficient to start Quantum Computing

Cannot overlay, because ListPlot does not draw same X range despite the same PlotRange

Why did the Middle Kingdom stop building pyramid tombs?

How to idiomatically express the idea "if you can cheat without being caught, do it"

How far can gerrymandering go?

Is it OK to say "The situation is pregnant with a crisis"?

Are all notation equal by derivatives?

How to track mail undetectably?

What could a Medieval society do with excess animal blood?

Are the plates of a battery really charged?

What was the ASCII end of medium (EM) character intended to be used for?

What is the function of const specifier in enum types?

Why is the saxophone not common in classical repertoire?

Is it OK to throw pebbles and stones in streams, waterfalls, ponds, etc.?

Other homotopy invariants?

Confusion in understanding the behavior of inductor in RL circuit with DC source

Finding an optimal set without forbidden subsets

Square wave to sawtooth wave using two BJT

Making arrow with a gradual colour

Find the closest three-digit hex colour

Aligning arrays within arrays within another array

How to extract coefficients of a generating function like this one, using a computer?

Is it advisable to inform the CEO about his brother accessing his office?



SQL procedure put today's date to the file name


sql server convert date to string MM/DD/YYYYHow to return only the Date from a SQL Server DateTime datatypeHow to check whether an object is a date?Insert results of a stored procedure into a temporary tableWhere can I find documentation on formatting a date in JavaScript?Function vs. Stored Procedure in SQL ServerFind all tables containing column with specified name - MS SQL ServerSearch text in stored procedure in SQL ServerPossible to put today's date as an alias?How to import an SQL file using the command line in MySQL?How to get today's date with pandas?













0















I am creating a procedure and trying to put output file name with today's date. Whenever I run it, I want to see that date with MMDDYYYY format.
I have 2 output file, so their name will be AD_MMDDYYY and the other one is IM_MMDDYYYY



 IF la_dtc_population.COUNT > 0
THEN
IF pv_file_type IN ('ID.&sysdate', 'AD.&sysdate' )


What it will be, this doesn't work? Thanks










share|improve this question






















  • Which DBMS product are you using? "SQL" is just a query language, not the name of a specific database product. Please add the tag for the database product you are using postgresql, oracle, db2, sql-server, ...

    – a_horse_with_no_name
    Mar 25 at 19:09











  • Possible duplicate of sql server convert date to string MM/DD/YYYY

    – TFD
    Mar 25 at 19:47















0















I am creating a procedure and trying to put output file name with today's date. Whenever I run it, I want to see that date with MMDDYYYY format.
I have 2 output file, so their name will be AD_MMDDYYY and the other one is IM_MMDDYYYY



 IF la_dtc_population.COUNT > 0
THEN
IF pv_file_type IN ('ID.&sysdate', 'AD.&sysdate' )


What it will be, this doesn't work? Thanks










share|improve this question






















  • Which DBMS product are you using? "SQL" is just a query language, not the name of a specific database product. Please add the tag for the database product you are using postgresql, oracle, db2, sql-server, ...

    – a_horse_with_no_name
    Mar 25 at 19:09











  • Possible duplicate of sql server convert date to string MM/DD/YYYY

    – TFD
    Mar 25 at 19:47













0












0








0








I am creating a procedure and trying to put output file name with today's date. Whenever I run it, I want to see that date with MMDDYYYY format.
I have 2 output file, so their name will be AD_MMDDYYY and the other one is IM_MMDDYYYY



 IF la_dtc_population.COUNT > 0
THEN
IF pv_file_type IN ('ID.&sysdate', 'AD.&sysdate' )


What it will be, this doesn't work? Thanks










share|improve this question














I am creating a procedure and trying to put output file name with today's date. Whenever I run it, I want to see that date with MMDDYYYY format.
I have 2 output file, so their name will be AD_MMDDYYY and the other one is IM_MMDDYYYY



 IF la_dtc_population.COUNT > 0
THEN
IF pv_file_type IN ('ID.&sysdate', 'AD.&sysdate' )


What it will be, this doesn't work? Thanks







sql date title






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 17:23









LatifeLatife

104 bronze badges




104 bronze badges












  • Which DBMS product are you using? "SQL" is just a query language, not the name of a specific database product. Please add the tag for the database product you are using postgresql, oracle, db2, sql-server, ...

    – a_horse_with_no_name
    Mar 25 at 19:09











  • Possible duplicate of sql server convert date to string MM/DD/YYYY

    – TFD
    Mar 25 at 19:47

















  • Which DBMS product are you using? "SQL" is just a query language, not the name of a specific database product. Please add the tag for the database product you are using postgresql, oracle, db2, sql-server, ...

    – a_horse_with_no_name
    Mar 25 at 19:09











  • Possible duplicate of sql server convert date to string MM/DD/YYYY

    – TFD
    Mar 25 at 19:47
















Which DBMS product are you using? "SQL" is just a query language, not the name of a specific database product. Please add the tag for the database product you are using postgresql, oracle, db2, sql-server, ...

– a_horse_with_no_name
Mar 25 at 19:09





Which DBMS product are you using? "SQL" is just a query language, not the name of a specific database product. Please add the tag for the database product you are using postgresql, oracle, db2, sql-server, ...

– a_horse_with_no_name
Mar 25 at 19:09













Possible duplicate of sql server convert date to string MM/DD/YYYY

– TFD
Mar 25 at 19:47





Possible duplicate of sql server convert date to string MM/DD/YYYY

– TFD
Mar 25 at 19:47










1 Answer
1






active

oldest

votes


















0














This might not answer your question, but the following SQL will fill the variable @date with the current date in the format mmddyyyy, which you can then use to create the appropriate filenames:



declare @now varchar(20) =
convert(varchar(20), getdate(), 20); -- Format 'yyyy-MM-dd hh:mm:ss'
declare @date varchar(20) =
substring(@now, 6, 2) + substring(@now, 9, 2) + substring(@now, 1, 4);


I think this should be pretty standard SQL (although I used MS-SQL/T-SQL to test it).






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343340%2fsql-procedure-put-todays-date-to-the-file-name%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    This might not answer your question, but the following SQL will fill the variable @date with the current date in the format mmddyyyy, which you can then use to create the appropriate filenames:



    declare @now varchar(20) =
    convert(varchar(20), getdate(), 20); -- Format 'yyyy-MM-dd hh:mm:ss'
    declare @date varchar(20) =
    substring(@now, 6, 2) + substring(@now, 9, 2) + substring(@now, 1, 4);


    I think this should be pretty standard SQL (although I used MS-SQL/T-SQL to test it).






    share|improve this answer



























      0














      This might not answer your question, but the following SQL will fill the variable @date with the current date in the format mmddyyyy, which you can then use to create the appropriate filenames:



      declare @now varchar(20) =
      convert(varchar(20), getdate(), 20); -- Format 'yyyy-MM-dd hh:mm:ss'
      declare @date varchar(20) =
      substring(@now, 6, 2) + substring(@now, 9, 2) + substring(@now, 1, 4);


      I think this should be pretty standard SQL (although I used MS-SQL/T-SQL to test it).






      share|improve this answer

























        0












        0








        0







        This might not answer your question, but the following SQL will fill the variable @date with the current date in the format mmddyyyy, which you can then use to create the appropriate filenames:



        declare @now varchar(20) =
        convert(varchar(20), getdate(), 20); -- Format 'yyyy-MM-dd hh:mm:ss'
        declare @date varchar(20) =
        substring(@now, 6, 2) + substring(@now, 9, 2) + substring(@now, 1, 4);


        I think this should be pretty standard SQL (although I used MS-SQL/T-SQL to test it).






        share|improve this answer













        This might not answer your question, but the following SQL will fill the variable @date with the current date in the format mmddyyyy, which you can then use to create the appropriate filenames:



        declare @now varchar(20) =
        convert(varchar(20), getdate(), 20); -- Format 'yyyy-MM-dd hh:mm:ss'
        declare @date varchar(20) =
        substring(@now, 6, 2) + substring(@now, 9, 2) + substring(@now, 1, 4);


        I think this should be pretty standard SQL (although I used MS-SQL/T-SQL to test it).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 25 at 19:41









        David R TribbleDavid R Tribble

        9,0382 gold badges34 silver badges48 bronze badges




        9,0382 gold badges34 silver badges48 bronze badges
















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343340%2fsql-procedure-put-todays-date-to-the-file-name%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript