Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

move data from development to production database

Status
Not open for further replies.

jordanking

Programmer
Sep 8, 2005
351
hello,

I have a production SQL server database that is going to "import" data from an access database. I have the Access DB upsized and attached to the server of the production database. I need to:
1) remove the relationships from several tables of the production DB
2) truncate a few tables(which is why I had to do the above step)
3) import the data from the upsized "Access DB"
4) restore the relationships that were deleted in step one.


My question: Is there a way to script the deletion and creation of Relationships in the production databse so I don't have to go through the database diagram?

.....
I'd rather be surfing
 
Hi,

Yes, you should be able to do that, In SQL Server, relationships are defined as Foreign Keys - so you would want to drop the Foreign Key Constraints on the destination tables (the ones you are going to truncate) prior to the Truncate operation. I'm not sure what toolset you're using, but usually you can fully script a create table statement. I would do that...as it would give you the code for the foreign key constraints. Then go ahead and truncate them, import your data, and re-establish those foreign keys. I would definitely run through all this in Dev. first though...

HTH,

Doc Tree
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top