Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rebuild relationships
Message
From
19/09/2005 00:15:47
Joel Hokanson
Services Integration Group
Bellaire, Texas, United States
 
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
01037208
Message ID:
01050778
Views:
12
Can this be run from VFP using SQLEXEC or does it need to be query analizer?




>Is there a way to store all of the current relationships and index files to a script or file, then delete all relationships and truncate all data.
>
>Then rebuild the relationships.

I would suggest different way to do the same
-- Disable FOREIGN KEY and CHECK constraints for all tables in DB

EXEC sp_MSforeachtable @command1="ALTER TABLE ? NOCHECK CONSTRAINT ALL"

-- Truncate tables
TRUNCATE TABLE dbo.mytable1
TRUNCATE TABLE dbo.mytable2
...

-- Enable FOREIGN KEY and CHECK constraints for all tables in DB
EXEC sp_MSforeachtable @command1="ALTER TABLE ?CHECK CONSTRAINT ALL"


--------------------------------------------------------------------------------
--sb--
MS MVP VFP


There are 10 types of people: Those who can read binary, and those who can't.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform