How to find the list of unused stored procedures in SQL Server 2005?

Hi,
I need to find out the list of stored procedures which are not in use.
I found there is something called "sys.dm_exec_procedure_stats " for SQL server 2008.
Can you please suggest your ides here to do the same job for SQL server 2005.
Many Thanks.

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.object_id), MAX(qs.last_execution_time)
   FROM   sys.sql_modules m
   LEFT   JOIN (sys.dm_exec_query_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.object_id)
But there are tons of caveats. The starting point of this query is
the dynamic management view dm_exec_query_stats, 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_stats.
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • Sender JDBC support the stored procedure in SQL Server 2005

    Dear All,
    My question here is , Sender is JDBC adpter support to call the Stored procedure in Microsoft SQL Server 2005?
    I followed the below thread before posting this question
    Sender JDBC Adapter Supports Stored Procedures????
    In the thread Suraj response has mentioned SAP note: 941317, I checked the note, Note says it supported only ORACLE DBMS versions.
    Could you please clarify about this to possibility to call the stored procedure in Microsoft SQL server 2005?
    Thank you in Advance
    Sateesh

    Hi Sateesh,
    To answer your query, Yes it does. SP call works with SQL Server 2005 as well, the SP call should be "execute SPNAME <paramas>". In the place of update statement put any junk value as mentioned in the earlier comment.
    But just one thing to be noted, the select or any other query returning the desired resultset must be the first statement in youre SP returning value to the calling app. Means if there are any update, deletion or intermediate select queries to be used with in your SP, those all should be placed after the Main Select query that returns the desired resultset. Variable declarions and assignments are allowed.
    But if the seq of statements in your SP are like:
    @var1 Varchar
    Update <tablename>....
    Select * from <tablename>
    Then the output of the SP is :
    1 row updated
    <the resultset from select>
    In such cases, PI can recognise the first value returned only, that is "1 row updated" and hence the returned resultset wouldn't be seen by PI or not be passed to integration engine. Hence the update should come after the main Select.
    One more interesting piece of information, even if you copy and paste the entire SP code in place of the query string of Sender JDBC adapter, that too will work with all your variable declarations, multiple queries and updates and everything. Just have to follow the above rule.
    Let us know what you find.
    Regards,
    Suddhasatta

  • Stored Procedure in SQL Server 2005

    Hi Friends,
    when i execute the stored procedure , i can get below error.
    Error processing request in sax parser: Error when executing statement for table/stored proc. 'XI_SP_KANLOGDATA_KLOGDATA' (structure 'Statement'): java.sql.SQLException: ERROR: Invalid XML document format for stored procedure: 'type="<SQL-type>"' attribute is missing for element 'table' (Setting a SQL-type (e.g. INTEGER, CHAR, DATE etc.) is mandatory !)
    My XML Message below format:
    <Statment>
    --<dbStmt action="EXECUTE">
      ---<table>storedprocedurename</table>
      ---<EMPNO isInput="true" type="char">0001</EMPNO>
      ---<EMPNAME isInput= "true type="char">Sateesh</EMPNAME>
      ---<ADDRESS isInput="true" type="char">Delhi</ADDRESS>
    --<dbStmt action="EXECUTE">
      ---<table>storedprocedurename</table>
      ---<EMPNO isInput="true" type="char">0002</EMPNO>
      ---<EMPNAME isInput= "true type="char">Sateesh1</EMPNAME>
      ---<ADDRESS isInput="true" type="char">Bangalore</ADDRESS>
    --<dbStmt action="EXECUTE">
      ---<table>storedprocedurename</table>
      ---<EMPNO isInput="true" type="char">0003</EMPNO>
      ---<EMPNAME isInput= "true type="char">Sateesh3</EMPNAME>
      ---<ADDRESS isInput="true" type="char">Hyderabad</ADDRESS>
    </Statement>

    Hi abishek,
    My scenario is basically JDBC(SQL Server)XIJDBC(ORACLE)(Synchronous)
    XI pick the date field from JDBC Sender and goes to ORACLE Database and selects records based upon the condition, and response back and put this data into JDBC(SQL Server),
    My process successfully upto receive the response from ORACLE system and after response mapping also successful.after that  response message is insert into SQL Server.
    In SQL server we have two tables,one DATA table and LOG table, If insert the data into DATA table successfully LOG table updated with DATE and STATUS field not successfully insert LOG table update with DATE and Error status field.
    So I impleted "stored procedure" in SQL side.
    Any way i solved that error.
    I am using below XML structure with out table field,i followed below blog.
    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9618. [original link is broken] [original link is broken] [original link is broken]
    My stored procedure name is: XI_SP_KDATA_KLOGDATA
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MT_DB_SELECT_REQUEST_response xmlns:ns0="urn:pg-siemens-com:POCA0013:sample1">
    - <Statement_response>
    - <XI_SP_KDATA_KLOGDATA action="EXECUTE">
      <EMPNO type="CHAR">901064</EMPNO>
      <EMPNAME type="CHAR">Sateesh</EMPNAME>
      <ADDRESS type="CHAR">Hyderabad</ADDRESS>
      </XI_SP_KDATA_KLOGDATA>
    - <XI_SP_KDATA_KLOGDATA action="EXECUTE">
      <EMPNO type="CHAR">901000</EMPNO>
      <EMPNAME type="CHAR">Ashish</EMPNAME>
      <ADDRESS type="CHAR">Bangalore</ADDRESS>
      </XI_SP_KDATA_KLOGDATA>
      </Statement_response>
      </ns0:MT_DB_SELECT_REQUEST_response>
    But again i faced one error in Communication channel
    Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'XI_SP_KDATA_KLOGDATA' (structure 'Statement_response'): com.microsoft.sqlserver.jdbc.SQLServerException: Procedure or function XI_SP_KANLOGDATA_KLOGDATA has too many arguments specified.
    My doubt is above error is Stored procedure error or XML Structure error?
    Don't hesitate to clarify me.
    Thank you.
    sateesh
    Edited by: sateesh kumar .N on Mar 4, 2010 11:58 AM
    Edited by: sateesh kumar .N on Mar 4, 2010 11:59 AM
    Edited by: sateesh kumar .N on Mar 4, 2010 12:00 PM

  • Creation of System Stored Procedure in SQL Server 2012 & SQL Server 2012 R2.

    Hi all,
    I am stuck at a point I am looking for a system stored procedure named 'sp_dboption' in SQL Server 2012  & R2 but could not find.
    Searched for it on the net and found that, this stored procedure 'sp_dboption' is now obsolete. So I tried to copy the content of 'sp_dboption' stored procedure from SQL Server 2008 R2 and create new system stored procedure with this name 'sp_dboption' in
    SQL Server 2012 but was unable to create the system stored procedure.
    Can you guys please tell me how to create system stored procedure in SQL Server 2012 & SQL Server 2012 R2. The reason of why I want to achieve this is because I have used 'sp_dboption' system stored procedure  in my application to create a database.
    As 'sp_dbotion' stored procedure is present in SQL Server 2008 R2 I am able to create the database in SQL server 2008 R2 but not in SQL server 2012.
    Can you please guide me how to create system stored procedure. I am out of luck.
    Please assist me, thanks & looking for help at the earliest. Hope someone will come to the fore and help me.

    Hi Vishwajeet,
    If you tried to create any object in the sys schema, you will get the error below.
    The specified schema name "sys" either does not exist or you do not have permission to use it.
    So I am afraid creating any object in sys schema is not supported by SQL Server. Here is a similar link for your reference.
    How to create table in SYS schema in SQL Server?
    Though sp_dboption is not in SQL Server 2012, does creating a user-defined one with the same content in 2008 make any difference in your business? You just need to specify the fully qualified name dbname.dbo.sp_dboption.
    If you are still interested in creating a system sp_dboption, you can register it with the
    sp_ms_marksystemobject.
    See
    Creating Your Own SQL Server System Stored Procedures.
    Eric Zhang
    TechNet Community Support

  • How to find the list of existing tables in a schema using DB link?

    Hi
    I know how to find the list of existing tables in a schema using the following query
    SQL> select * from tab;
    but, how to list the tables using a DB link?
    For Example
    SQL> select * from tab@dblink_name;
    why this doesn't work?
    Pl advice me
    Thanks
    Reddy.

    ORA-02019: connection description for remote database not foundHave you used this database link successfully for some other queries?
    The error posted seems to indicate that the DB Link is not functional at all. Has it worked for any other type of DML operation or is this the first time you ever tried to use the link?

  • How to find the list of Queries/Reports which are using Exceptional Aggregation in SAP BI?

    Hi All,
    We are interested to know how to find the list of Queries/ Reports which are using Exceptional aggregation in SAP BI.
    Please let us know is there any table's to check the list of reports using Exceptional Aggregation in SAP BI.

    Hi,
    Here you go..
    1) Go to table RSZCALC and get list of ELTUID where AGGREXC is not INITIAL and AGGRCHA is not initial; now you get only exception aggregation set based on some chars. Also you can further add STEPNR = 1 since your intention is just to get query name , not the calculation details; this will reduce number of entries to lookup and save DB time for next steps.
    Here you will get list of exception aggregation UUID numbers from which you can get properties from RSZELTDIR.
    2) Pass list of RSZCALC-ELTUID to table RSZELTXREF - TELTUID and get list of RSZELTXREF -SELTUID - this table stores query to it's elements maping kind.
    3) Now again pass RSZELTXREF - SELTUID into same table but into different field RSZELTZREF - TELTUID and get RSZELTXREF - SELTUID
    This step you get query reference sheet or column or query general UUID for next step.
    4) Pass list of RSZELTXREF - SELTUID into RSZELTDIR - ELTUID with DEFTP as 'REP'. Now you get list of query names in RSZELTDIR - MAPNAME and description in TXTLG.
    Note: you can also get the reference chars used for exception aggregation from RSZCALC - AGGRCHA field.
    Hope this helps.
    Please keep in mind, it might take more time depends on how many query elements you have in the system...
    Comments added for better DB performance by: Arun Thangaraj

  • How to find the list of Queries for that have statistics enabled in the sys

    Hi ,
    How to find the list of Queries  that have statistics enabled on them in the system.
    Please help me in this regard
    Thanks
    Maruthi

    hi ,
    I found three options there like
    X - on
    D - Default
    off
    can you please expalin the difference between on and Default
    Thanks in Advance
    Maruthi

  • How to find the list of all tables populated

    How to find the list of tables populated in the implentation of a particular company. DD02L contains all the tables SAP having. But i want only which are configured for a particular company.
    Also how to find the list of reports used by all users in a particular company. TSTC contains all transactions. But i require only reports used by a particular company.

    Hi Mohamed
    You use Solution Manager to do the comparison for you.  There are some nice features that will highlight all your customised coding.  Have a look at the SolMan resources on the Support Portal e.g. using SolMan for upgrade comparisons.
    Rgards
    Carl.

  • How to find the list of Tables....

    Hi
    How to find the list of Tables associated with When a Goods Issue is done for a Process Order ??
    Kindly tell me step-by-step procedure in browsing it.
    cheers
    MaruthiRam

    Hi
    goto SE16 Click F4, You have two options Information system & Sap Applications.
    Click on SAP Applications & selec the application you wnat to see, for E.g Purchasing you can click on materials managemnt, Purchasing if you drill down you will see the list of tables....
    reward points if useful
    Thanks & Regards
    Kiran

  • How to find the list of all user exits modified by the users

    How to find the list of all user exits using by in R3

    Hi Mohamed
    You use Solution Manager to do the comparison for you.  There are some nice features that will highlight all your customised coding.  Have a look at the SolMan resources on the Support Portal e.g. using SolMan for upgrade comparisons.
    Rgards
    Carl.

  • How to find the List of expired user Ids

    How to find the List of expired user Ids

    Can you please tell me the question in detail.What do u mean by expired users?
    IN a Client or in a System.

  • How to find the list of applications registered with OID?

    Could some one please help me?
    how to find the list of applications registered with OID?

    Is there any table from which we would be able to see?

  • How to find the list of unsettled fully/partially PM orders

    Hello,
    Pls let me know how to find the list of fully/Partially unsettled orders list?

    you can find it for a collection of orders thru S_ALR_87013015. get the list display of orders using IW 39 copy the order number to clipboard and transfer to S_ALR txn. Choose the correct controlling area.
    you get the settled amount credit / debit etc

  • Command for "How to find Cursor Size" in Oracle Stored Procedure"

    Hi
    Can u tell me....
    How to find Cursor Size" in Oracle Stored Procedure........
    I want command for that........

    why don't you try select count(*) from your_table;That requires running the same query twice - or rather running two different queries twice. Besides it still doesn't guarantee anything, because Oracle's read consistency model only applies at the statement level (unless you're running in a serialized transaction).
    This is such a common requirement - users are wont to say "well Google does it" - it seems bizarre that Oracle cannot do it. The truth is that that Google cheats. Firstly it guesses the number on the basis of information in its indexes and refines the estimate as pages are returned. Secondly, Google is under no onus to kepp all its data and indexes synchronized - two simultaneous and identical queries which touch different Google servers can return different results. Oracle Text works the same way, which is why we can get a count with CTX_QUERY.COUNT_HITS in estimate mode.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com
    .

  • Improve the performance in stored procedure using sql server 2008 - esp where clause in very big table - Urgent

    Hi,
    I am looking for inputs in tuning stored procedure using sql server 2008. l am new to performance tuning in sql,plsql and oracle. currently facing issue in stored procedure - need to increase the performance by code optmization/filtering the records using where clause in larger table., the requirement is Stored procedure generate Audit Report which is accessed by approx. 10 Admin Users typically 2-3 times a day by each Admin users.
    It has got CTE ( common table expression ) which is referred 2  time within SP. This CTE is very big and fetches records from several tables without where clause. This causes several records to be fetched from DB and then needed processing. This stored procedure is running in pre prod server which has 6gb of memory and built on virtual server and the same proc ran good in prod server which has 64gb of ram with physical server (40sec). and the execution time in pre prod is 1min 9seconds which needs to be reduced upto 10secs or so will be the solution. and also the exec time differs from time to time. sometimes it is 50sec and sometimes 1min 9seconds..
    Pl provide what is the best option/practise to use where clause to filter the records and tool to be used to tune the procedure like execution plan, sql profiler?? I am using toad for sqlserver 5.7. Here I see execution plan tab available while running the SP. but when i run it throws an error. Pl help and provide inputs.
    Thanks,
    Viji

    You've asked a SQL Server question in an Oracle forum.  I'm expecting that this will get locked momentarily when a moderator drops by.
    Microsoft has its own forums for SQL Server, you'll have more luck over there.  When you do go there, however, you'll almost certainly get more help if you can pare down the problem (or at least better explain what your code is doing).  Very few people want to read hundreds of lines of code, guess what's it's supposed to do, guess what is slow, and then guess at how to improve things.  Posting query plans, the results of profiling, cutting out any code that is unnecessary to the performance problem, etc. will get you much better answers.
    Justin

Maybe you are looking for