Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

sp_truncate

By Sergey Benner, 2009/01/23

Total article views: 1501 | Views in the last 30 days: 20

sp_truncate <table_2_truncate>

I've created this procedure several months ago and I hope it would be helpful.

It truncates the table even those which are referenced by some other tables' foreign keys.

We shall truncate the table test1 which is referenced by e.g. 2 tables (test2,test3)

Then we execute sp_truncate test1 

 

Hope it will save you lots of time like it did for me.

By Sergey Benner, 2009/01/23

Total article views: 1501 | Views in the last 30 days: 20
Your response
 
 
Related Articles
FORUM

truncate permission

truncate permission

FORUM

Truncate log

Truncate log

FORUM

Truncate

How do you give a user Truncate Permission?

SCRIPT

Truncate All Tables

Script to Truncate all tables part1

FORUM

truncate the transactional logfile

truncate the transactional logfile

Tags
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones