General information
Forum:
Microsoft SQL Server
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only