|thumbs up for this forum and am glad there's so many volunteers around on line.|
I'm not familiar with batch, so maybe someone would be so kind to enlighten me with answer. Be very thankfull.
I try to backup many sql db with osql and then rename them with appended date ( and time)( .bak to .dat is optional too)
wanna have all code in one batch so that I would be able to schedule it
Found the way to backup sql db with osql and it works fine.
Also found the way to rename file in batch code and it works fine too.
But when I try to join two of them together it backups files but with no rename part. I'm stucked and seems to not find the way out of this hole.
Can someone help me, please, my eyes cannot see over that obstacle.
:: BAT file
osql -U** -P** -Sserver\SQLEXPRESS2005 -ddb -u -w250 -n -l 30 -iback.txt -ooutput.txt
rename FOR /F "TOKENS=1,2*" %%A IN ('DATE/T') DO SET DATE=%%B
rename SET DATE=%DATE:/=%
rename FOR /F "TOKENS=*" %%A IN ('TIME/T') DO SET TIME=%%A
rename SET TIME=%TIME::=%
rename set TODAY=%DATE%%TIME%
rename echo %TODAY%
rename "C:\back\TEST.bak" "TEST%TODAY%.dat"