April 14, 2008 at 12:00 am
Hi ,
Is there any Way to delete all the datas in all the tables of a database without reloading the database.
Expecting your valuable suggestions.Thanks in Advance for your kind co-operation
Best Regards,
Rajesh
April 14, 2008 at 3:36 am
Rafal S. created a script to get the job done.
See this link: http://www.sqlservercentral.com/scripts/Miscellaneous/62115/
April 14, 2008 at 5:45 am
use the buit in sp of sql server :
sp_foreachtable 'delete from ?'
it will delete the values from all the tables.
Thanks ,
Amit Gupta
(MCP)
April 14, 2008 at 6:05 am
AMIT GUPTA (4/14/2008)
use the buit in sp of sql server :sp_foreachtable 'delete from ?'
it will delete the values from all the tables.
Thanks ,
Amit Gupta
(MCP)
Not if you have foreign key constraints. Then you need to delete from "child" tables before you can delete from "parent" tables.
John
April 14, 2008 at 4:59 pm
Would not it be easier to just generate a script creating empty database?
_____________
Code for TallyGenerator
April 14, 2008 at 8:14 pm
I agree with Sergiy... life would be a lot easier that way... create a "Gold Set" of scripts or even an empty database to copy from.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 15, 2008 at 2:09 am
Why post the same question again when you got an answer here
http://www.sqlservercentral.com/Forums/Topic484231-8-1.aspx
N 56°04'39.16"
E 12°55'05.25"
April 15, 2008 at 5:54 am
How rude... I hate it when people cross post... wastes everyone's time.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply