Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Copy Database

Author  Topic 

Round
Starting Member

6 Posts

Posted - 2006-12-15 : 07:41:32
Hello all,
I'm new here and I found this forum in the hope that someone could answer my question.

Can I copy a database c/w tables, structure and views etc without any data? I just want an empty copy of a specific db.

I am using SQL Server Enterprise Manager and IIS.

Many Thanks

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-15 : 08:03:31
Generate script of all database objects on the source machine and run it on the target machine.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-12-16 : 04:33:56
Or Backup and Restore to the target database, and then truncate tables, or delete the data.

This would probably not be a good solution for a database with GBs of data ...

However, it would be a good solution if you don't want to delete ALL the data - e.g. you have a Country Code Lookup table or something like that.

Kristen
Go to Top of Page

Round
Starting Member

6 Posts

Posted - 2006-12-18 : 07:12:24
If I generate a script to copy the database, do I need to ensure all the options are checked? Also which file option for the file format should I choose, or how do I tell which one to choose from between MS-DOS, ANSI or Unicode?
I want the copy to exist on the same machine as the original.

Many Thanks
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-12-18 : 09:07:51
I do all the options for Primary key, FKs, Constrains etc. and use the Windows ANSI option.

I leave off the Create Database and Create Users stuff (assuming this is SQL2000 they are the ones in the top half of the second tab, so I check all the things in the bottom half of the second tab).

If that doesn't make sense when you get to it ask again and I'll fire up Enterprise Manager and refresh my memory of exact which ones I choose!

Kristen
Go to Top of Page

Round
Starting Member

6 Posts

Posted - 2006-12-18 : 10:12:09
Ok Thanks thats great, I will keep you posted. I will be doing it in the next few days.
Yes it is SQL2000

Many Thanks
Wayne
Go to Top of Page

Round
Starting Member

6 Posts

Posted - 2007-01-24 : 09:40:27
Hello again,
I finally got back to this project and ran the script generator, I then ran the script within query analyzer. All seems good.
Many Thanks to all for your help and advice.
Go to Top of Page
   

- Advertisement -