Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rebuild relationships
Message
De
19/09/2005 00:15:47
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:
01050778
Vues:
18
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform