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


Droping or moving old tables


Droping or moving old tables

Author
Message
m.rajesh.uk
m.rajesh.uk
SSC Veteran
SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)

Group: General Forum Members
Points: 279 Visits: 598
How to validate the last updated date for each of the tables.
I want you to check if the tables are updated in real-time

·How to check if the tables going to move or delete have any dependencies.

·Please include any suggestions for how to drop these tables.

The reason for moving or deleting these tables is we are running out of space on that server.
Orlando Colamatteo
Orlando Colamatteo
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15035 Visits: 14396
You can check the dependencies of the table using the Catalog Views:

USE AdventureWorks2008R2;
GO
SELECT referencing_schema_name,
referencing_entity_name,
referencing_id,
referencing_class_desc,
is_caller_dependent
FROM sys.dm_sql_referencing_entities('[Person].[PersonPhone]', 'OBJECT');



You can check the index usage stats, but if you yourself have selected from the table your stats will be polluted. These stats are reset after a service restart so if you check these stats after a restart and do not touch the table yourself you might get lucky to know if anyone is accessing it.

USE AdventureWorks2008R2;
GO
SELECT *
FROM sys.dm_db_index_usage_stats
WHERE OBJECT_NAME(object_id) = 'Department'
AND OBJECT_SCHEMA_NAME(object_id) = 'HumanResources';



You may want to setup a Trace to look for queries referencing the table and run it for a few months. Else you could risk it, export the table to a file using bcp and the native data format (fastest), save off the DDL for the table with all indexes and permissions, and drop the table.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
m.rajesh.uk
m.rajesh.uk
SSC Veteran
SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)

Group: General Forum Members
Points: 279 Visits: 598
Thanks for your reply.
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