SET logdir=c:\1
if not exist %logdir%\nul mkdir %logdir%

SET B_SCRIPT_TARGET=c:\2
if not exist %B_SCRIPT_TARGET%\nul mkdir %B_SCRIPT_TARGET%

SET B_DataFiles_TARGET=c:\3
if not exist %B_DataFiles_TARGET%\nul mkdir %B_DataFiles_TARGET%

SET B_Database_Name=partnercrmfz
SET B_DATE=%date:~4,4%%date:~9,2%%date:~12,2%
REM SET B_DATE=%date:~0,4%%date:~5,2%%date:~8,2%
ECHO use master ;>%B_SCRIPT_TARGET%\FULL_backup.sql
ECHO go >>%B_SCRIPT_TARGET%\FULL_backup.sql
ECHO SP_ADDUMPDEVICE 'DISK',>>%B_SCRIPT_TARGET%\FULL_backup.sql
ECHO 'BackupDatabase%B_Database_Name%file%B_DATE%_FULL', >>%B_SCRIPT_TARGET%\FULL_backup.sql
ECHO '%B_DataFiles_TARGET%\%B_Database_Name%%B_DATE%_FULL.bak'; >>%B_SCRIPT_TARGET%\FULL_backup.sql
ECHO go >>%B_SCRIPT_TARGET%\FULL_backup.sql
ECHO BACKUP DATABASE %B_Database_Name% >>%B_SCRIPT_TARGET%\FULL_backup.sql
ECHO TO BackupDatabase%B_Database_Name%file%B_DATE%_FULL >>%B_SCRIPT_TARGET%\FULL_backup.sql
ECHO WITH NOINIT , NOUNLOAD ;>>%B_SCRIPT_TARGET%\FULL_backup.sql
ECHO go >>%B_SCRIPT_TARGET%\FULL_backup.sql
ECHO .

SET OSQL_PATH=C:\msde2000\MSSQL\Binn\

SET DBUser=sa
SET DBpassword=partner
"%OSQL_PATH%osql.exe" -U %DBUser% -P %DBpassword% -i %B_SCRIPT_TARGET%\FULL_backup.sql -o %logdir%\backupdatabase%B_DATE%_Full.log


DEL /Q %B_SCRIPT_TARGET%\FULL_backup.sql
