Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Vishal Pawar is workin in The Most Group as MSBI Solution Architech
Browse by Tags · View All
sql 103
Query 58
#BI 32
Link 31
SQL Server 31
BI 30
#SQL Server 28
SSIS 23
brh 21
SSMA 17

Archive · View All
August 2011 36
June 2011 25
July 2011 21
December 2011 17
October 2011 12
September 2011 11
April 2012 7
November 2011 7
March 2012 5
January 2012 5

Vishal Pawar's Blog

BISQL # 93 - How to find list of Stored procedure which does not depend on any table operation

Apr 26 2012 12:00AM by Vishal Pawar   

Hi Friends ,

Continuing from my last series of Code reviewing..

  • BISQL # 90 – How to find Number of lines of Code in procedure or function

  • Reviewing and Updating in Existing Database with very less amount of time is really challenging task for all architects. Its not rocket science we have evolved from whatever we have in terms of resource , Knowledge and Research.We must always find way which will solve our current problem and save future time.Saving future time is most important aspect.

Now this all conversation i have shared because from my one of post in which i have explain how can Tables, Columns ,Procedures More readable and more easy and easy to maintain.

On my previous article (How to establish / Find relationship between Table and stored Procedure in Database) in which we have already covered following points :

  • How to analyse all schema
  • How to analyse all Tables in Database 
  • How to analyse all procedure
  • How to analyse all dependency Between Table and Stored Procedure
  • Establishing Relation Between  Table and Stored Procedure
  • Final and Quick result script for Relationship of Table and Stored Procedure

  • In this article we are going to cover following problem statement

    Problem : How to find stored procedure which is not participating and Stored procedure table relationship

    Lets do some querying to get expected result first on Adventure work DB

    Following query will provide us Stored procedure in given system

    SELECT * FROM Sys.procedures

    Which have following in output as 9 stored procedure

    image 

    Now lets fire query which we have already discuss : Final and Quick result script for Relationship of Table and Stored Procedure

    SELECT DISTINCT             p.name AS 'Stored Procedure' ,             s.name AS 'Schema Name',             t.name AS 'Table Name' FROM        sys.sysdepends AS d INNER JOIN    sys.procedures AS p  ON            d.id = p.object_id INNER JOIN    sys.tables AS t ON t.object_id = d.depid INNER JOIN    sys.schemas AS s  ON            t.schema_id = s.schema_id;

    Which shows output as in which stored procedure which table have been used

    image

    Now here what our problem requirement is in which stored procedure we not using any of table

    So following is Key query which answer to our problem statement

    SELECT  name FROM    sys.procedures WHERE   object_id NOT IN (         SELECT DISTINCT                 p.object_id         FROM    sys.sysdepends d INNER JOIN sys.procedures p ON d.id = p.object_id INNER JOIN sys.tables t ON t.object_id = d.depid INNER JOIN sys.schemas s ON t.schema_id = s.schema_id )

    Which in output will provide list of SP which is not dependent on any table

    image

    We can clearly see this output and output compare to just above script stored procedure uspPrintError does not contain any table in its definition

    Tags: Link,Query,SQL


    Vishal Pawar
    24 · 7% · 2229
    0
    Liked
     
    0
    Lifesaver
     
    0
    Refreshed
     
    0
    Learned
     
    0
    Incorrect



    Submit

    Your Comment


    Sign Up or Login to post a comment.

        Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]