Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Cleaning Up Garbage from Data Expand / Collapse
Author
Message
Posted Monday, February 22, 2010 11:56 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 3:06 PM
Points: 17,805, Visits: 15,716
Thanks for the article. I tend to use the method similar to what Paul described.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Post #870601
Posted Monday, February 22, 2010 10:18 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, February 7, 2013 11:21 PM
Points: 34, Visits: 60
Hi all,

Good day.
Shubhajyoti, you need to improve your SQL skills, not waste time to create a sp to delete tables.

if you want to create some tmp tables, you can name them like a#t_customer, a#t_sales...
then when you need to delete them, they sit at the top of table list. then just delete them.
You marked them with special name at first place.

What you are doing is not a good habit.
at DBA's view, this is not even acceptable.

have fun.
Ben
Post #870906
Posted Monday, February 22, 2010 11:35 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 27, 2011 11:34 AM
Points: 23, Visits: 53
Hi Ben,

Your recommendation is appreciated, But not always need to delete Temp table explicitly. If someone working as DBA, then he or she have oder option to handle DB as per his / her expertise. But in generally
developer those are not typically working as DBA if they need to solve this kind of problem. they can go through this type of approach may be according to experts this are not an optimize solution. As I already mentioned Time, Situation, proper analysis point of view is play as a major factor to solve a particular problem. But in our world may be don't have enough time analysis of our problem lots of other factor also.

So my approach is just a blinking of light to overcome the dark situation. Rather than search out for a halogen.


Regards,

shubha
www.freegamingnow.com



Post #870933
Posted Tuesday, February 23, 2010 12:04 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, February 7, 2013 11:21 PM
Points: 34, Visits: 60
Shubhajyoti Ghosh (2/22/2010)
Hi Ben,

Your recommendation is appreciated, But not always need to delete Temp table explicitly. If someone working as DBA, then he or she have oder option to handle DB as per his / her expertise. But in generally
developer those are not typically working as DBA if they need to solve this kind of problem. they can go through this type of approach may be according to experts this are not an optimize solution. As I already mentioned Time, Situation, proper analysis point of view is play as a major factor to solve a particular problem. But in our world may be don't have enough time analysis of our problem lots of other factor also.

So my approach is just a blinking of light to overcome the dark situation. Rather than search out for a halogen.


Regards,

shubha
www.freegamingnow.com





Hi shubha,

Good day.

Yeah, time is everything. There are more inside a blinking, not only light.


Our world only exists inside a blinking, Outside this blinking only our illusions.

it likes film, 24 pics per second. but only pics, not movements.
they are tables, but if you define them as Garbage, you can delete them in whatever name.

Yes, you are right, sometime we need to delete some tables.
the differences are how many clicks: 1,10 or 500...


have fun

Ben
Post #870941
Posted Tuesday, February 23, 2010 12:22 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 27, 2011 11:34 AM
Points: 23, Visits: 53
Nice counter attack

Regards,

Shubha
www.freegamingnow.com
Post #870945
Posted Tuesday, February 23, 2010 10:23 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, February 16, 2012 7:34 PM
Points: 59, Visits: 375
Also not what I was expecting.

We download data from a legacy system and we constantly find garbage like a date of 06/31/1997, a time like 08:75 am or Social Security Numbers with the wrong number of characters or blanks in fields that are supposed to be required. That was the sort of garbage I was thinking of, not deletion of all the rows in a bunch of tables.

A better title might have been "Automating Deletion From Multiple Tables".

I have to delete all the data in the tables before starting a load from my other system and it's a pain with 20 or 30 tables that are slowly changing as we continue development.

I agree with Paul that DELETE really chews up your log and my test server isn't that big. I prefer to use TRUNCATE.

I tried keeping a "TruncateAll" script with all the constraints that needed to be dropped, tables to truncate & constraints to be re-added but someone was always adding a table or contraint and forgetting to put it in the script.

Your solution is interesting. I will look at it further and see if it can be used to automatically TRUNCATE tables.
Post #871303
Posted Thursday, March 4, 2010 10:22 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, August 29, 2011 9:30 AM
Points: 10, Visits: 31
EXEC stp_CleanGarbageData 'Table_1, Table_2, Table_3, Table_n'


Just a minor comment. Since you are identifying tables that you want to keep; I think a better name for a stored procedure would be: stp_ExcludeFromGarbageDataCleanup.
Post #876973
Posted Thursday, March 4, 2010 11:16 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 27, 2011 11:34 AM
Points: 23, Visits: 53
thanks for your suggestion. Yes it is also a good name.


Regards,

shubha
www.freegamingnow.com
Post #877023
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse