Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Here are college, every single student gets an MSSQL database. Because we have several thousand student however, user-rights are restricted. You get 1 database, and only one.

If you're making multiple ASP.NET website, you just put the new tables in the same database. That's how it is and it's not going to change.

Now, I work on a home computer as well, with my local database to make things easy. Most sites had 2 or 3 tables with a couple of entries, so making them again on the school database I have and entering the data again isn't a lot of work.

This time however, our assignment involves the NorthWind Database, an example database that Microsoft has up for download, for everyone to use.

I'm looking for a way to tell my school database to add the tables from the Northwind database, in to its own database. I'm using mssql management studio 2008 r2. I've been looking around a bit but haven't found anything. Is this at all possible?

Also, deleting tables from the school database doesn't seem to work. Always getting an error that says there are foreign keys so it can't be deleted. Selecting all tables and trying to delete them all at once doesn't work either.

share|improve this question

1 Answer 1

You cannot remove objects that are referenced.

To copy table structure to a different database, script the CREATE TABLE statements to a .sql script file, and run that on the target database.

To copy table data to a different database, use the bcp utility to generate exports on the source server, and use BULK INSERT on the target server to load these files.

SQL Books Online (BOL) contains details for these procedures.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.