Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rebuild relationships
Message
 
 
À
29/07/2005 23:25:42
Joel Hokanson
Services Integration Group
Bellaire, Texas, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Divers
Thread ID:
01037208
Message ID:
01037292
Vues:
24
This message has been marked as the solution to the initial question of the thread.
>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--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform