473,735 Members | 8,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

removing unused objects - SQL Server 2000 or 2005

Sometimes at the end of a project you'll end up with unused Tables,
Stored Procs, Functions, and Views.
Since there is not something like a 'SELECT' trigger ... what is the
best way for telling what is not being used by your solution? To turn
on some kind of tracing?

Any ideas?

Thanks,
Kelly Greer
ke*********@nos pam.com
change nospam to yahoo

Jan 22 '08 #1
4 5686
Copy -Paste from Tony articles

In SQL 2005 there is, sort of. This is query lists the last execution
time for all SQL modules in a database:

SELECT object_name(m.o bject_id), MAX(qs.last_exe cution_time)
FROM sys.sql_modules m
LEFT JOIN (sys.dm_exec_qu ery_stats qs
CROSS APPLY sys.dm_exec_sql _text (qs.sql_handle) st)
ON m.object_id = st.objectid
AND st.dbid = db_id()
GROUP BY object_name(m.o bject_id)

But there are tons of caveats. The starting point of this query is
the dynamic management view dm_exec_query_s tats, and the contents is
per *query plan*. If a stored procedure contains several queries,
there are more than one entry for the procedure in dm_exec_query_s tats.

"kellygreer 1" <ke*********@ya hoo.comwrote in message
news:8f******** *************** ***********@v46 g2000hsv.google groups.com...
Sometimes at the end of a project you'll end up with unused Tables,
Stored Procs, Functions, and Views.
Since there is not something like a 'SELECT' trigger ... what is the
best way for telling what is not being used by your solution? To turn
on some kind of tracing?

Any ideas?

Thanks,
Kelly Greer
ke*********@nos pam.com
change nospam to yahoo

Jan 22 '08 #2
Uri Dimant (ur**@iscar.co. il) writes:
Copy -Paste from Tony articles

In SQL 2005 there is, sort of. This is query lists the last execution
time for all SQL modules in a database:

SELECT object_name(m.o bject_id), MAX(qs.last_exe cution_time)
FROM sys.sql_modules m
LEFT JOIN (sys.dm_exec_qu ery_stats qs
CROSS APPLY sys.dm_exec_sql _text (qs.sql_handle) st)
ON m.object_id = st.objectid
AND st.dbid = db_id()
GROUP BY object_name(m.o bject_id)

But there are tons of caveats. The starting point of this query is
the dynamic management view dm_exec_query_s tats, and the contents is
per *query plan*. If a stored procedure contains several queries,
there are more than one entry for the procedure in dm_exec_query_s tats.
And very importantly: it only lists what's in the cache. A procedure could
fall out of the cahce for several reasons. For instance, adding an index
on a table, flushes all plans related to that table. And a server restart
empites the cache entirely.

I would be very careful to use information of that kind to draw
conclusion of whether an object is in use.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jan 22 '08 #3
On Jan 21, 6:36 pm, kellygreer1 <kellygre...@ya hoo.comwrote:
Sometimes at the end of a project you'll end up with unused Tables,
Stored Procs, Functions, and Views.
Since there is not something like a 'SELECT' trigger ... what is the
best way for telling what is not being used by your solution? To turn
on some kind of tracing?

Any ideas?

Thanks,
Kelly Greer
kellygre...@nos pam.com
change nospam to yahoo
have you checked out SQL Dependency Tracker?
Jan 22 '08 #4
On Jan 22, 5:28 pm, Alex Kuznetsov <alk...@gmail.c omwrote:
On Jan 21, 6:36 pm,kellygreer1< kellygre...@yah oo.comwrote:
Sometimes at the end of a project you'll end up with unused Tables,
Stored Procs, Functions, and Views.
Since there is not something like a 'SELECT' trigger ... what is the
best way for telling what is not being used by your solution? To turn
on some kind of tracing?
Any ideas?
Thanks,
Kelly Greer
kellygre...@nos pam.com
change nospam to yahoo

have you checked out SQL Dependency Tracker?
Thanks for the ideas. I'm going to try this SQL Dependency Tracker
too.
See they have a trial on their site.

kellygreer1
Jan 23 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2815
by: Chris Halcrow | last post by:
Hi I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP. I continually get the error 'cannot configure server' just at the end of the installation. I've tried the following: - Removing SQL server from 'Program Files' folder following an unsuccessful attempt to re-install, and entirely removing the registry entry 'HKEY_CURRENT_USER > SOFTWARE > Microsoft > MSSQLServer', as well as the corresponding entry under...
3
2229
by: datapro01 | last post by:
I am a DB2 DBA that has been asked to become familiar enough with SQL Server in order to become actively involved in its installation, implementation, and to review database backup/recovery procedures. SQL Server will be used by a vendor packaged application. The problem is that we are awaiting word on whether it will be SQL Server 2000 or 2005 we will be working with. I have been told that there are considerable differences between the...
2
1458
by: mal hit | last post by:
I would like to know if it's possible to embed a SQL Server 2000/2005 DB within a desktop application so that the end users cannot view the DB. Also, this will prevent them from copying the database on to their other SQL Servers. Also, what are the options to load SQL Server 2005 on Win 98 *** Sent via Developersdex http://www.developersdex.com ***
0
1984
by: dunleav1 | last post by:
Does enabling/disabling Data Execution Prevention (DEP) have a performance impact on SQL 2000 or SQL 2005?
4
3757
by: David | last post by:
Hi all, I just asked some people to help me out and phone microsoft with the following information, kindly they refused unless we setup a support contract with them first, for pre-sales information. (That really does not sound like good business sense to me - anyway here is our problem, if anyone could help thanks). "To tell and ask microsoft:
0
1058
by: samindra | last post by:
I need to Add & update 100 plus users info daily basis. Right now I am doing one at a time through the vendors GUI interface. I need to do this process with bulk additions & bulk updates. My db environment is SQL Server 2000/2005 Could you please let me know much efficient way to do this process? Thanks & Regards, Sam
0
1327
by: =?Utf-8?B?RENvdW50MTc=?= | last post by:
I need to create a windows application in which I can programmatically create local cubes from SQL Server 2005 databases using C#. I was able to do this in SQL Server 2000, but I cannot get the same results after upgrading to 2005 because the CREATE GLOBAL CUBE command does not slice the data as it did in 2000. In other words, I get all accounts that exists in the company as opposed to only accounts that belong to the user. This extra data...
4
4129
by: Feris T | last post by:
Hi, Is there any development library exist in the market for SQL Server 2000/2005 transaction log reader ? I need to use it for Capture Data Change (CDC). Preferably Java. Regards, Feris
2
2531
by: Yemata Abebe | last post by:
What is the maximum number of records SQL Server 2000, 2005 and Oracle 11g can handle
0
8962
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9463
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9327
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6747
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6049
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4559
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4822
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3273
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2188
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.