RMS 1.2 Database Backup

I am looking for a small batch files that backs up my POS database on a daily basis where the backup file name is the system date and time.

I found a batch file backup with a fixed file name on MS Customer Source but would rather want to keep daily copies.

Reply to
Gerd
Loading thread data ...

Thanks Antonio, that's exactly what I was looking for.

Reply to
Gerd

Antonio,

I just tried to run the following db_backup.cmd but get an error on the + sign. Here is the exact syntax of the command with the error message:

C:\Program Files\Microsoft Retail Management System>OSQL -U UserName -P password -S TCS50

-Q "BACKUP DATABASE main TO DISK = 'c:\Program Files\Microsoft Retail Management System\Backup\Backup-' + str(year(getdate())) + str(month(getdate())) + str(day(getdate())) '.bck' WITH FORMAT, STATS" Msg 170, Level 15, State 1, Server TCS50, Line 1 Line 1: Incorrect syntax near '+'.

Reply to
Gerd

"Gerd" ha scritto nel messaggio news:% snipped-for-privacy@TK2MSFTNGP10.phx.gbl...

BACKUP DTABASE yourdbname TO DISK = 'yourpath\backupdb_' + str(year(getdate())) + str(month(getdate())) + str(day(getdate())) + str(datepart(hh,getdate()))+str(mi(getdate()))+str(datepart(ss,getdate())) '.bck'

Reply to
Antonio Mazzeo

"Gerd" ha scritto nel messaggio news: snipped-for-privacy@tk2msftngp13.phx.gbl...

DECLARE @fullpath nvarchar(255)

set @fullpath = 'c:\Program Files\Microsoft Retail Management System\Backup\Backup-' + str(year(getdate())) + str(month(getdate())) + str(day(getdate())) + '.bck'

BACKUP DATABASE main TO DISK = @fullpath WITH FORMAT, STATS

sorry for my error antonio

Reply to
Antonio Mazzeo

Hi Antonio,

could I bother you again. I made the changes you specified but now I get the following error message:

C:\Program Files\Microsoft Retail Management System>OSQL -U sa -P password -S TCS50 -Q "BACKUP DATABASE main TO DISK = @fullpath WITH FORMAT, STATS" Msg 137, Level 15, State 2, Server TCS50, Line 1

Here is the complete .cmd file I use:

declare @fullpath nvarchar(255)

set @fullpath = 'c:\Program Files\Microsoft Retail Management System\Backup\Backup-' + str(year(getdate())) + str(month(getdate())) + str(day(getdate())) + '.bck'

OSQL -U sa -P hina -S TCS50 -Q "BACKUP DATABASE main TO DISK = @fullpath WITH FORMAT, STATS"

Reply to
Gerd

Please write "DECLARE @FULLPATH NVARCHAR; SET @FULLPATH 'blablablablablablbalba'; BACKUP DATABASE main TO DISK = @FULLPATH WITH FORMAT,STATS"

SQL Server raise an error because the @FULLPATH variable isn't declared.

bye antonio

Reply to
Antonio Mazzeo

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.