|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Monday, May 20, 2013 1:07 PM
Points: 18,733,
Visits: 12,332
|
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, February 07, 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
|
|
|
|
|
Grasshopper
      
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
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, February 07, 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
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, June 27, 2011 11:34 AM
Points: 23,
Visits: 53
|
|
|
|
|
|
Valued 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.
|
|
|
|
|
Grasshopper
      
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.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, June 27, 2011 11:34 AM
Points: 23,
Visits: 53
|
|
|
|
|