SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


sp_truncate


sp_truncate

Author
Message
sergey.benner
sergey.benner
Old Hand
Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)

Group: General Forum Members
Points: 316 Visits: 164
Comments posted to this topic are about the item sp_truncate
Jason Miller-476791
Jason Miller-476791
SSC Veteran
SSC Veteran (218 reputation)SSC Veteran (218 reputation)SSC Veteran (218 reputation)SSC Veteran (218 reputation)SSC Veteran (218 reputation)SSC Veteran (218 reputation)SSC Veteran (218 reputation)SSC Veteran (218 reputation)

Group: General Forum Members
Points: 218 Visits: 694
Like the script. However, I noticed 2 areas for improvement. If I'm "deleting" all the rows from the primary key, I want all the foreign rows wiped out as well. Also, the foreign key constraints get dropped and recreated, but it is missing the cascade options.

I have a similar procedure, but mine was written for a specific table. I guess I could modify it to handle more, but it would probably be easier to modify your procedure.

Thanks, IMHO, that's a very valuable script.

Honor Super Omnia-
Jason Miller
Martin Goebbels
Martin Goebbels
SSC Rookie
SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)

Group: General Forum Members
Points: 28 Visits: 21
That is the kind of procedure all developer must have. Sure, there can be improvements, and you will make this code ever better.
sergey.benner
sergey.benner
Old Hand
Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)

Group: General Forum Members
Points: 316 Visits: 164
Thanks guys. Although it has a low rating here BigGrin it really did save lots of time for me.
We had a bunch of tables which needed this kind of intervention so I had to make it.
thanks Smile
kodracon
kodracon
SSC-Enthusiastic
SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)

Group: General Forum Members
Points: 103 Visits: 162
Hi All

this is my script that also attempts to truncate a referenced table:
http://www.sqlservercentral.com/scripts/Foreign+Key/65452/

Enjoy
sergey.benner
sergey.benner
Old Hand
Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)

Group: General Forum Members
Points: 316 Visits: 164
I didn't use embedded sp_fkeys procedure there.
I did everything using the pure joins. Smile
Heck... I wrote it - one year ago. lol
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search