Get Date from DB and rename a file

March 9, 2010 at 04:31:45
Specs: Windows XP
How can i fetch a date from the database and rename a file with that date(how to get a value from database in a variable in batch file).

See More: Get Date from DB and rename a file

Report •


#1
March 9, 2010 at 05:21:56
Much depends on the format of the DB.

Should we guess?


=====================================
Helping others achieve escape felicity

M2


Report •

#2
March 9, 2010 at 12:41:41
most database-management apps have a version of "export" (as in "to asciifile") OR a text-file reporting capability. You need to establish the record-selection criteria then export or "list-to-text" the date field from the record or records that qualify. your batch can then pick them up from the text file.

Report •

#3
March 9, 2010 at 20:57:44
M2 i want to rename the file in yyyymmdd format.
nbrane i am not sure how to implement your solution.

Report •

Related Solutions

#4
March 9, 2010 at 21:07:45
M2 when i query the database i get the date in following format:
3/10/2010 1:05:32 PM

But when i spool the output from the batch file i get the file as follows:

SF_DATE ---------------------
10-MAR-10


Report •

#5
March 10, 2010 at 02:30:05
> How can i fetch a date from the database
> and rename a file with that date(how to get
> a value from database in a variable in batch file).
>

There's 2 ways to handle this:
- go to the database (whatever the tool is) and find a feature that allows writing to a file (if it exists). Some DB-query languages have such a tool, others have not. Ask an application-programmer that works on writing software for the application which uses that database.
- The other way is my favorite, and that is the other way round. Use the OS command line, to query something on the database (the date, for example), and redirect output to a file (or to the command line) and work with that, in a OS script kind of matter. You will need a non-graphic (command line) interface program with your database, for this to work ... or, be lucky that you have a GUI which allows all ouput to be forwarded to a file.

What is the database, what is the tool used to access the DB ?


Report •

Ask Question