I am trying to restore SQL server DB, replacing the existing one but donot know how to do it.
My purpose is to restore the backup file selected by user, no matter if file with this name is already attached to the server or not. If it is there, it should be replaced by the new one.
Could any body give me vb.net code for it?
Thanks
That’s easy and hard.
Have you worked out what the sql is?
Are you restoring the entire back up or just a number of dbs out of it.
Do you want to sanity check it at all?
How are you going to deal with sql server’s service account not having permission to see the file?
What about those using the database when it’s requested.
Do you want to show progress as it restores?
Are there other considerations, emailing, permissions, MSMQ, replication….
Which sql server versions are you coping with?
If you aren’t going to do this properly don’t bother,m leave it the their IT / DBA people. The more hand holding you want to do, the more the scope will creep…