Membership Membership:
Latest New User Latest: vpros
Past 24 Hours Past 24 Hours: 0
Prev. 24 Hours Prev. 24 Hours: 0
User Count Overall: 137

People Online People Online:
Visitors Visitors: 1
Members Members: 0
Total Total: 1

NakedMCSE Computer Tech Support Forums

So you have passed all of the exams and you are now out in the real world of windows servers, linux servers and freebsd servers faced with a tech support problem you have never seen before...

Find free online tech support in the forums below, respecting that advice is free, but work beyond advice is not...

The General forum is provided for off topic discussion.

You need a user account to post - please Register or Login.

Online Tech Support Forums
  Forum  Microsoft Tech ...  SQL Server  SQL Express Database Backup Script
Disabled Previous
Next Next
New Post 10/9/2009 4:25 PM
119 posts
10th Level Poster

SQL Express Database Backup Script 
Modified By Walker  on 10/9/2009 4:26:11 PM)

SQL Express does not come with an automatable backup solution.  So you have to write yourself a little SQL script to do it :

declare @daynumber nvarchar(1024)

select @daynumber = 'C:\Backup\My-databasebackup-' + CAST(DAY(GETDATE()) AS char(2)) + '.bak';
backup database [My-Database] to disk = @daynumber with format;

This script will create a filename for the backup with the day number in the month tagged to the back of it.

You then save that script somewhere (say C:\backup\backup.sql) and then schedule this command to run it on whatever schedule you need :

sqlcmd -S servername\instancename -E -i C:\Backup\backup.sql

Where you replace servername\instancename with the correct server and instance names and use the correct path to your saved SQL file.

Lairds Computer Services

Disabled Previous
Next Next
  Forum  Microsoft Tech ...  SQL Server  SQL Express Database Backup Script
Send me One Million FREE Guaranteed Visitors