I have a database in MS SQL Sever 2005 Express. I need to make a duplicate of it to test some upgrade scripts. I've tried to backup and restore to a new database, and it fails because it can tell the databases are different. I don't see a way to script out the entire database, otherwise I'd try that. What is the best way to make a copy of an existing database on the same machine.

What do you mean by "it fails because it can tell the databases are different"? The upgrade script fails or the backup/restore fails? Also, do you need the data or just the db schema?
–
squillmanAug 5 '10 at 16:07

I need both data and schema, and the "it fails..." relates to the sentence it is in, the backup and restore fails because it detects that the database from the backup is different then the target for the restore.
–
dryeAug 5 '10 at 16:22

So you're trying to restore it over an existing database?
–
squillmanAug 5 '10 at 16:34

No, a new database. Turns out there is a force parameter and you have to move the MDF and LDF files.
–
dryeAug 5 '10 at 16:49

Got it. Yeah, that was where I was going next. lg's answer should do it for you also.
–
squillmanAug 5 '10 at 16:50