0

Hi,
can anybody suggest me how to take backup and restore of sqlexpress.
I have used sqlexpress in my project i have little bit idea about taking backup and restore of sql server using SMO but unaware about sqlexpress. Can anybody help me please....

Thanks in Advance

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by nick.crane
0

You just need to use the appropriate SQL command.
I use something like this:
Backup -
"USE MASTER; BACKUP DATABASE [<DBName>] TO DISK = N'<FileName>' WITH FORMAT, INIT, NAME = N'<Backup Name>', SKIP"
Restore -
"USE MASTER; RESTORE DATABASE [<DBName>] FROM DISK = N'<FileName>' WITH FILE = 1, REPLACE"

Execute using the SQLCommand.ExecuteNonQuery method.

Note: I run the command in a service to ensure full access.
Not sure if it will work from a standard user program (which is probably why I do it from a service.)

-1

Hi nick.crane, Can you explain the query in little bit detail

what is "USE MASTER",
Thanks in advance

Edited by bhagawatshinde: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.