I would like to remove all test data and reset the autonumbers from a series of tables within an SQL database. The DROP command seems to delete the table. Is there any other way of keeping the structure and just removind and resetting?
Thanks.
Microsoft SQL Server 2005
Last Comment
Jagdish Devaku
8/22/2022 - Mon
mherchl
TRUNCATE TABLE table_name
drequinox
trucnate is good. if you need complete database and truncate all table try considering
EXEC sp_MSForEachTable 'Truncate Table ?'
this will truncate all tables without having to run the statement for each table individually.
chrislindsay
ASKER
Hi Guys,
I am obtaining foreign key constraints using the truncate command. Using EXEC sp_MSForEachTable 'Truncate Table ?' my database is VPMA_cert and I want to reset all tables within this.
Where do I insert this database name in the expression above?
Thanks