Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
scelamko
Constraint Violating Yak Guru
309 Posts |
Posted - 2008-06-19 : 12:54:32
|
Is there any way to develop a generic Truncate table script for all the tables in the database based on foreign key relationshipsfor example Employee table is parent of the EmployeeSal and EmployeeBenefits, HR table is HRDivision and HRManagerMy truncate statement order should be as follows I have tried using sysobjects and sysforeignkeys to develop a generic script but it didnt work out.TRUNCATE TABLE EMPLOYEETRUNCATE TABLE EMPLOYEESALTRUNCATE TABLE EMPLOYEEBENEFITSTRUNCATE TABLE HRTRUNCATE TABLE HRDIVISIONTRUNCATE TABLE HRMANAGERIs this even possible to develop a generic script for all the tables in the database.Thanks |
|
|
|
|