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?
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
add a comment |
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
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 usingpostgresql
,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
add a comment |
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
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
sql date title
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 usingpostgresql
,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
add a comment |
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 usingpostgresql
,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
add a comment |
1 Answer
1
active
oldest
votes
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).
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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).
add a comment |
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).
add a comment |
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).
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).
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
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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