Flame
14495 pts. | Mar 2 2009 4:54PM GMT
Carlosdl,
I made a few changes listed below, but this is EXACTLY what I needed. The changes is made removed the space that was appearing after the filename, but before the “.txt” extension as well as a space that appeared between the filename and the “;”
Thank you!
-Flame
Modified bat file:
del script.txt set date=%date:~0,3%_%date:~4,13%.UNL; echo set server server1; >> script.txt echo connect testdb 1 sysadm/XXXXXX; >> script.txt echo update statistics on database; >> script.txt echo check database; >> script.txt echo commit; >> script.txt echo SET BULK ON; >> script.txt echo unload database z:backupsVIS_%date% >> script.txt echo disconnect all; >> script.txt echo EXIT; >> script.txt
Resulting Script:
set server server1; connect testdb 1 sysadm/XXXXXX; update statistics on database; check database; commit; SET BULK ON; unload database z:backupsVIS_Mon_03/02/2009.UNL; disconnect all; EXIT;
Perfect!
Flame
14495 pts. | Mar 2 2009 5:13PM GMT
Wow, Silly mistake (which the system infomed me of…) You can’t have a “/” in a file name (doh!)
Fixed code below:
Batch file:
del Autoname_Unload.sql
set date=%date:~0,3%_%date:~4,2%_%date:~7,2%_%date:~10,4%.UNL;
echo set server server1; >> Autoname_Unload.sql
echo connect testdb 1 sysadm/XXXXXX; >> Autoname_Unload.sql
echo update statistics on database; >> Autoname_Unload.sql
echo check database; >> Autoname_Unload.sql
echo commit; >> Autoname_Unload.sql
echo SET BULK ON; >> Autoname_Unload.sql
echo unload database z:backupsVIS_%date% >> Autoname_Unload.sql
echo disconnect all; >> Autoname_Unload.sql
echo EXIT; >> Autoname_Unload.sql
Resulting Script:
set server server1;
connect testdb 1 sysadm/XXXXXX;
update statistics on database;
check database;
commit;
SET BULK ON;
unload database z:backupsVIS_Mon_03_02_2009.UNL;
disconnect all;
EXIT;
That’s better!
Thanks again Carlosdl!
Flame
14495 pts. | Mar 2 2009 5:17PM GMT
Interesting note here…
The files I copied had the “” symbol in the correct places in the paths of the batch files… but they did not seem to paste into the discussion section… Is there a way to edit the comments to reflect this?
Flame
14495 pts. | Mar 2 2009 5:20PM GMT
Apparently you can’t even type the symbol that is a mirror image to “/” in the discuss section. Interesting…
Carlosdl
29350 pts. | Mar 2 2009 5:51PM GMT
Yes Flame, you cannot use the mirror of ‘/’ here (I guess it is taken as some type of escape character)…
I noticed you change ‘>’ for ‘>>’ in this line:
echo set server server1; >> script.txt
Have you tried running this script more than once ? I think it will cause the new script to be appended at the end of the previously generated, so the file will grow endlessly.
Flame
14495 pts. | Mar 2 2009 6:13PM GMT
Thats why the first line of the script is :
del Autoname_Unload.sql
I though the single “>” was a typo… (Needed more coffe this morning I guess…)
I’m planning on running a test tonight, then going live after that.
Thank you again!
Flame






