Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement