Reputation: 1286
I have been developing an asp.net mvc site on a local version of sql server express 2008 and about a month ago I set up the web host and got everything working, the host uses sql server 2005. The site is not live.
Now a month down the track I need to do a fairly big update and the database is way out of date.
I would like to know how I can retain the database but blow everything else away (tables etc.) so I can run the set up script again.
When I try a few things I find on the internet it complains about the foreign keys and doesn't delete.
Thanks in advance
Upvotes: 2
Views: 320
Reputation: 556
my guess: it's all about the order you drop the tables
ex
table1 key fKeyTable2 (foreignkey from table 2)
table2 key
first drop table 2, then drop table1
if its hard to figure out the order you can try this: ALTER TABLE tbl_name DROP FOREIGN KEY fk_symbol; (fk_symbol = the foreign key that is being complained about)
Upvotes: 1
Reputation: 16708
Take a look at this answer to a question about disabling FK constraints, and rejoice! :)
Upvotes: 2
Reputation: 21905
if you truly don't need to retain anything (including users, roles, UDTs, etc), then just drop the db and create a new one.
Upvotes: 3