Hi,
I have write one stored proc which will multiple stored proc based on the dependencies of tables
to check that the root tables are filled first and then to fill reference tables.
Thank you
Hi,
I have write one stored proc which will multiple stored proc based on the dependencies of tables
to check that the root tables are filled first and then to fill reference tables.
Thank you
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Srinivasan RamamoorthiRank #877 · 2.5K reputationPosted Oct 7, 2021, 1:35 AM EDT
Srinivasan RamamoorthiRank #877 · 2.5K reputationPosted Oct 6, 2021, 12:51 PM EDT
jayu p111 reputationPosted Oct 6, 2021, 11:59 PM EDT
Hi SrinivasanI am creating a data model, where I have to import data from staging tables to final table in different schema within same database.To achieve this dynamically I am going to write procedure for each table to import data Each table is dependent on other and while importing I have check the dependencies of tables so that each root tables are filled if no check done then importing data will fail.I have to do this by sql only Thank you
Periyasamy VellingirisamyRank #1,142 · 1.6K reputationPosted Oct 7, 2021, 1:06 AM EDT
jayu p111 reputationPosted Oct 7, 2021, 7:39 AM EDT
Srinivasan RamamoorthiRank #877 · 2.5K reputationPosted Oct 7, 2021, 7:47 AM EDT
Try the below scripts in Stored procedure. Ensure SP has permission to enable/disable constraints
-- Disable all table constraints
ALTER TABLE TableName NOCHECK CONSTRAINT ALL
-- Enable all table constraints
ALTER TABLE TableName CHECK CONSTRAINT ALL
-- ----------
-- Disable single constraint
ALTER TABLE TableName NOCHECK CONSTRAINT Constraint Name
-- Enable single constraint
ALTER TABLE TableName CHECK CONSTRAINT Constraint Name