Dependencies between Objects

Hi Folks,
My client has asked me to move from one db to another. (I don't know why, may be they are restructuring). Now the problem is that there are many stored procedures, functions and tables which I have created and also using somewhere. Now for moving these objects
I have to do manual checks on each of my procedure to find out dependencies.
First I used SP_DEPENDS but that didn't show correct results. Then I did use
SYS.DM_SQL_REFERENCING_ENTITIES, but a weird thing I noticed. Some of my procedures are not listed in this table.
Basically I need the output in below format:
NAME
TYPE
DEPENDED UPON
TYPE
COLUMN NAME
RealTimeLeads
Stored Proc
INSTrigger
Trigger
OfferDateTime
RealTimeLeads
Stored Proc
INSTrigger
Trigger
EnquiryDateTime
RealTimeLeads
Stored Proc
cc_lead__c_upd
User Table
ID__c
RealTimeLeads
Stored Proc
cc_lead__c_upd
User Table
CustomerName__c
RealTimeLeads
Stored Proc
cc_lead__c_upd
User Table
Product__c
SP_CampaignDashboard
Stored Proc
CampaignDashboard
User Table
CD_ID
SP_CampaignDashboard
Stored Proc
EmailCampaign_Attempts
User Table
AttemptCount
SP_CampaignDashboard
Stored Proc
OfferProduct_Master
User Table
Product__c
SP_CampaignDashboard
Stored Proc
Portal_Campaign_Attempts
User Table
AttemptCount
SP_CampaignDashboard
Stored Proc
Responses
User Table
ResponseDate
SP_CampaignDashboard
Stored Proc
SMS_Campaign_Attempts
User Table
AttemptCount
Chaos isn’t a pit. Chaos is a ladder. Many who try to climb it fail and never get to try again. The fall breaks them. And some are given a chance to climb, but they refuse. They cling to the realm, or the gods, or love. Illusions. Only the ladder is real.
The climb is all there is.

I did some tests. If you do not have sys.dm_sql_referencing_entities, you probably run SQL Server 2005 or lower. Alas, SQL_Dependencies seems to have the same shortcommings as the old fashioned dbo.sysdepends view. When you create an object referencing an
object that doesn't exist yet, this reference is not captured. Changing the order of creation can help you out. However, circular references will never be captured. Also, dropping and re-creating an object destroys the information in this view. Proof:
The below creation order causes the link between TestProc and TestView to be missed.
CREATE PROC TestProc AS SELECT * FROM TestView
GO
CREATE TABLE TestTab (i int not null)
GO
CREATE VIEW TestView AS SELECT * FROM TestTab
GO
-- Transact-SQL Statement to list all objects and their dependencies (SQL Server 2005).
SELECT SCH.name + '.' + OBJ.name AS ObjectName
,OBJ.type_desc AS ObjectType
,REFSCH.name + '.' + REFOBJ.name AS ReferencedObjectName
,REFOBJ.type_desc AS ReferencedObjectType
,REFCOL.name AS ReferencedColumnName
,DEP.class_desc AS ReferenceClass
,DEP.is_selected AS IsSelected
,DEP.is_select_all AS IsSelectAll
,DEP.is_updated AS IsUpdated
FROM sys.sql_dependencies AS DEP
INNER JOIN
sys.objects AS OBJ
ON DEP.object_id = OBJ.object_id
INNER JOIN
sys.schemas AS SCH
ON OBJ.schema_id = SCH.schema_id
INNER JOIN sys.objects AS REFOBJ
ON DEP.referenced_major_id = REFOBJ.object_id
INNER JOIN sys.schemas AS REFSCH
ON REFOBJ.schema_id = REFSCH.schema_id
LEFT JOIN sys.columns AS REFCOL
ON DEP.class IN (0, 1)
AND DEP.referenced_minor_id = REFCOL.column_id
AND DEP.referenced_major_id = REFCOL.object_id
ORDER BY ObjectName
,ReferencedObjectName
,REFCOL.column_id
GO
DROP TABLE TestTab
GO
DROP VIEW TestView
GO
DROP PROC TestProc
GO
Changing the order helps:
CREATE TABLE TestTab (i int not null)
GO
CREATE VIEW TestView AS SELECT * FROM TestTab
GO
CREATE PROC TestProc AS SELECT * FROM TestView
GO
-- Transact-SQL Statement to list all objects and their dependencies (SQL Server 2005).
SELECT SCH.name + '.' + OBJ.name AS ObjectName
,OBJ.type_desc AS ObjectType
,REFSCH.name + '.' + REFOBJ.name AS ReferencedObjectName
,REFOBJ.type_desc AS ReferencedObjectType
,REFCOL.name AS ReferencedColumnName
,DEP.class_desc AS ReferenceClass
,DEP.is_selected AS IsSelected
,DEP.is_select_all AS IsSelectAll
,DEP.is_updated AS IsUpdated
FROM sys.sql_dependencies AS DEP
INNER JOIN
sys.objects AS OBJ
ON DEP.object_id = OBJ.object_id
INNER JOIN
sys.schemas AS SCH
ON OBJ.schema_id = SCH.schema_id
INNER JOIN sys.objects AS REFOBJ
ON DEP.referenced_major_id = REFOBJ.object_id
INNER JOIN sys.schemas AS REFSCH
ON REFOBJ.schema_id = REFSCH.schema_id
LEFT JOIN sys.columns AS REFCOL
ON DEP.class IN (0, 1)
AND DEP.referenced_minor_id = REFCOL.column_id
AND DEP.referenced_major_id = REFCOL.object_id
ORDER BY ObjectName
,ReferencedObjectName
,REFCOL.column_id
GO
DROP TABLE TestTab
GO
DROP VIEW TestView
GO
DROP PROC TestProc
GO

Similar Messages

  • PowerDesigner doesn't respect dependencies between objects when generating script

    Good afternoon,
    I'm getting very frustrated trying to do something that should be 'by default' or easy to configure within PowerDesigner 16.5 working with a SQL Server 2008 R2 database.
    I reverse-engineered a database into a physical model for modifications and I want to generate DDL from the physical model.   I've worked around some issues including how to support SQL Server filtered indexes and a few others things. 
    However a really stupid think that I have not been able to figure out is how to have the script respect dependencies between objects in the model.   When looking at the model at the Dependencies table the dependencies seem to be in place correctly.   But when I choose the 'Generate Database...' menu item to generate a single script to create all of the objects within a database it does create them all but in alphabetical order which does not work because there are dependencies between objects (views, in particular) that requires specific views to be created in a different order depending on their dependencies.
    Most tools understand the dependencies and create a script that will work.
    How can I generate a database script from PowerDesigner that respects the dependencies between the objects (in this case between different databse views) so they get scripted out in the correct order.
    Thanks much,
    Don

    I figured this out via the use of 'Traceability Links' within the View Properties.  
    Let me tell you... the only way to set these is to create a diagram and visually link things together because working through the grid on the property pages to select additional Linked Objects is just incredibly slow and painful.   You should be able to just free-text enter Linked Object names (with the model validating them) without having to traverse the model to individually select each object.   I had a lot of dependencies and it took several hours to incorporate them all.
    I'm also disappointed that the reverse-engineering of a SQL Server database into a physical model doesn't use the sysdepends data to create 'Traceability Links' to associate dependencies between views, stored procedures, etc.   That would have saved me a lot of work.
    I know that PowerDesigner is a 'generic' product that works with several databases... but being a person that only works with a particular database (in my case SQL Server) the lack of out of the box support (filtered index reverse engineering is an example that quickly comes to mind) is frustrating.

  • Mapping dependencies between objects

    I'm querying a database to obtain information from 10 tables. The goal is to display the information on a JSF based portlet using a tree-view, where an user can use the tree interface to drill to desired level of detailed information. The interface may need to show 3/4 different tree-views of the same data set.
    To begin with, I'm doing a join across those tables and load a hash (representing the first hierarchy in the tree) with multiple levels to represent the tree-view or the dependency between various parameters. If there are 3 views required, I'm thinking about building 3 such hashes - where the elements in the hash will probabaly be derived from a TreeNode class to build the gui. Since all the views refer to the same underlying data model, each node of the Hash will actually refer to some object that stores the model data.
    I have two questions:
    * Currently I'm building the hash by parsing the ResultSet obtained from query; Is there a better way to do this? I thought about using O/R mappers; but I couldn't think of an elegant solution to load the collections from a query to represent the dependencies dictated by the view.
    * Is there a better way to design the query?
    I would really appreciate any comments.

    Thanks for the suggestions. I have a generic class for building a tree-view - and that uses recursion. However, that doesn't need to know about the parent-child relationship. I was thinking of parsing the db query result and store the parent child relationship in a nested hash. My generic Tree class implementation would know to take this nested hash and build the tree. Essentially an instantiation of the generic class or it's extended version would act as a backing bean for a JSF component.
    Anyway, I'll try to focus more on a Hibernate based approach as you guys hinted. I'll wait for Dave's feedback. Actually, I have his book on the portlet API.

  • Import Oracle Designer model dependencies between objects

    Hello,
    I am using the Oracle Designer model import to fill Data Modeler. There are some views which have dependencies on each other, resulting that views which depend on other views are incomplete.
    Is there a way to rerun the import again in the same relational model, since the import utility now opens a new relational model again.
    Is there a kind of logging where you can find these kind of errors?
    Best regards,
    Joop

    Thanks Phillip, but I was actually referring to the version level of the Designer repository itself, not the database instance in which it resides. I seem to remember that you could not upgrade your Designer repository without also upgrading the Oracle Designer client as well; hence my question about compatibility between SQL Developer Data Modeler and various Repository versions.

  • BP change documents ( linking problem between Object id and Business Partner)

    Hi,
    We need to create a report for documents changed for a Business partner.
    This will be done in sap bw.
    on source side I have created the datasource with function module changedocument_read and I am getting most of the information
    which I want. Only missing part is Business Partner number.
    Can somebody suggest , how I would be able to link Object Id to business partner.
    I need to pull everything that is changed at BP level and the Object class selection around 30 in number.
    So I am looking for any standard function module which can provide me the link between Object id and Business partner.
    If I establish the rules to determine the Business partner from Object id , its getting bit difficult.
    Can somebody please help/suggest.
    I have gone through many documents and scn posts but unable to find anything on this.
    Thanks !

    Hi, looking at the change history header table CDHDR it seems that object ID simple equals the internal format of the business partner number.

  • Copy and paste styles between objects and entire slides

    Hi,
    In Keynote 5 I was able to copy and paste styles between objects and even between entire slides.
    cmd+alt+c on one object (like a circle) and all its details like shadows, colors and animations could be transferred to another object.
    One could even do it with entire slides and transfer one animation style to all the other slides.
    THAT DOES NOT WORK ANYMORE.
    Does anybody else miss these features?
    Or is it just me?

    object animations tools are:
    copy animation:   Format > Copy Animation
    paste animation   Format > Paste Animation
         there are no keyboard short commands for these.
    There are no tools to copy or paste transitions between slides, you could duplicate the slide then add the content.

  • Gap between objects

    I know there are several threads about this but I haven't found a decent answer. I have a logo I'm working on with overlapping shapes, strokes, etc. Everything looks fine in Illustrator but when I export the file to show the client, whether it be a .png, .pdf, .jpg, there is a hairline gap between objects. Is this only a screen issue or will the hairline gap print?

    That's right, it's a screen issue. So printing the vector file will be fine.
    You have a problem is when you want to show a pixel version to a client.
    Place the AI file as a smart object in Photoshop
    See my answer here for a solution:
    Illustrator divide problem
    You can also skip the Photoshop route by using the Rasterise effect in Illustrator and export as .png, jpegs etc.

  • Differences Between Object And System Privileges

    Hi,
    Whats the difference between object and system privileges in oracle?
    Cheers
    Paul

    System Privileges
    A system privilege is the right to perform a particular action, or to perform an action on any schema objects of a particular type. For example, the privileges to create tablespaces and to delete the rows of any table in a database are system privileges.
    Schema Object Privileges
    A schema object privilege is a privilege or right to perform a particular action on a specific schema object:
    For example, the privilege to delete rows from the departments table is an object privilege.
    Some schema objects, such as clusters, indexes, triggers, and database links, do not have associated object privileges. Their use is controlled with system privileges. For example, to alter a cluster, a user must own the cluster or have the ALTER ANY CLUSTER system privilege.
    A schema object and its synonym are equivalent with respect to privileges. That is, the object privileges granted for a table, view, sequence, procedure, function, or package apply whether referencing the base object by name or using a synonym.
    Granting object privileges on a table, view, sequence, procedure, function, or package to a synonym for the object has the same effect as if no synonym were used. When a synonym is dropped, all grants for the underlying schema object remain in effect, even if the privileges were granted by specifying the dropped synonym.

  • Differences between object and object references

    What's the differences between object and object references? To me, it seems the same, but I am sure there are differences.
    Student s = new Student("Joe",20);
    s is an object of class Student. Can we say s is an object reference of class Student?
    Please clarify. thanks!!

    Student s = new Student("Joe",20);
    s is an object of class Student. Can we say s is an
    object reference of class Student?The thing you created via "new Student()" is an object. The variable you declared via "Student s" contains a reference to that object. People say all kinds of things but I find it clearer to differentiate between variables and the objects they refer to.

  • Relationship between Objects Not Found in PA

    Dear all,
    I have uploaded objects (Org Unit, Job, and Position) and the relationships between objects separately using LSMW.
    When i checked the update of the relationship between objects in PA30, but the relationship between objects (Org Unit, Job, and Position) did not exist, yet exists in PP02.
    I tried to upload the relationships between objects using holder (A008) in LSMW again, still I could not find the relationships in PA30, but exist in PP02.
    Then I tried to run rhinte00 and rhinte30 to link the relationship between objects. I managed to get through rhinte00, but failed to run rhinte30.
    Below is the report log when I tried to run rhinte30.
    Report log:   
    Processing mode:   Processing successful 
    Number of personnel nos. selected :   0 
    Personnel numbers with errors:

    Check the following.
    1. Check if integration is active in T77S0 table PLOGI PLOGI = Your active plan version & PLOGI ORGA = X
    2. Check if all your objects are created with this active plan version
    3. Check the feature PLOGI to see if your PA PSA etc for the employee are integrated.
    cheers
    Ajay

  • White Space between Objects?

    Alright,
    I seem to be having a problem to where there is white space between objects and no matter how many times I intersect paths I still have white-space between objects. Obviously if you are making some sort of illustration, even a pixel worth of white space could prove to be problematic. I have provided a screenshot of the problem I am receiving. I cannot move the objects together to fix this problem. May anyone please offer advice or a solution to this issue?
    As you can see in the screenshot we are seeing white space between the blue and purple objects.
    Any help would be greatly appreciated!
    Thank you all so much!
    Aaron

    Thanks for this reply dougofakkad. This answer lead me to find what I was looking for...
    This question and it's answers go over the problem:
    http://forums.adobe.com/thread/845303
    This blog post answers the problem:
    http://www.sarasjodin.com/2013/06/place-objects-exactly-illustrator/
    Thank you so much!

  • Creating custom mappings between objects

    I currently have a db schmea that supports "soft" deletes. Example:
    Client table has fields:
    id - primary key (number)
    name - varchar
    active ("Y" or "N" where "Y" means active and "N" means "INACTIVE")
    We also have a table Users:
    id - primary key (number)
    name - varchar
    active ("Y" or "N" where "Y" means active and "N" means "INACTIVE")
    When I delete a user I want to set its active field to "N" and then when
    someone reads users from the client (after I have saved my changes) I want
    only users whoses active field is "Y" to be returns, i.e.
    Client clientA = <read client A>
    Collection users = clientA.getUsers();
    Is there a way to configure/customize the mapping/relationship between
    objects?
    Thanks!
    Bruce

    All of the emails are really my way of getting a soft delete to work. Does
    KODO support this feature or is their a standard work around to support
    this feature?
    Thanks!
    Bruce
    Alex Roytman wrote:
    You could break you collection into multiple mutually exclusive
    subcollections (like active/inactive) and have your object model to map them
    separately (via views with mutually exclusive criterion) When changing a
    collection member's status you will need to move it from active collection
    to inactive. Complete collection can be dode as dybamic (delegating)
    composition of the subcollections (but it will cost twice as much to fetch
    it)
    Try to resolve your issues on object model level. I believe altering sql
    mappings to make them very fancy will cause you lots of grief in the long
    run
    "Bruce" <[email protected]> wrote in message
    news:[email protected]...
    I also want to do something similiar to support object history. I could
    have a Client object which gets modified and instead of editing this
    object I would copy it, inactivate the copy and then edit the original.
    This allows for full history. I can always select by active (or a more
    complicated status) to get the rest of the history instead of the "top".
    Views here seems like a hack. I have activew fields in all of my tables so
    I would nee views for each table which is a lot to manage if fields are
    changing (need to change them in both places). Also this creates issues
    since views are really read-only.
    Isn't there a way to change the SQL used to read a relationship?
    Bruce
    Alex Roytman wrote:
    map your classes against views with (where active = 'Y') to make sure
    "soft
    deleted" records do not get read and have your object model to handlesoft
    deletes (like removing from collections etc) use helper methods to do"soft
    deletes" masking real deletes is not good idea - you will need them atsome
    point
    "Stephen Kim" <[email protected]> wrote in message
    news:[email protected]...
    While there is nothing default that does particularly what you desire,
    but from my perspective, you should not have Kodo do anything by
    default
    as you will probably want to delete the inactive instances at somelater
    point.
    Instead you should look into Query.setCandidates:
    http://www.solarmetric.com/Software/Documentation/2.4.3/docs/jdo-javadoc/jav
    ax/jdo/Query.html
    i.e. public Collection getActiveUsers ()
    PersistenceManager pm = JDOHelper.getPersistenceManager
    (this);
    Query q = pm.newQuery (User.class, true);
    q.setFilter ("active == "N"");
    q.setCandidates (users);
    return q.execute ();
    I haven't tested the above code and there are a lot of optimizations
    you
    could do such as caching the query in a transient collection but Ithink
    you get the idea.
    You may want to post your thoughts on our newsgroups
    (news://news.solarmetric.com) and see how other people are tackling
    similar probles..
    Bruce wrote:
    I currently have a db schmea that supports "soft" deletes. Example:
    Client table has fields:
    id - primary key (number)
    name - varchar
    active ("Y" or "N" where "Y" means active and "N" means "INACTIVE")
    We also have a table Users:
    id - primary key (number)
    name - varchar
    active ("Y" or "N" where "Y" means active and "N" means "INACTIVE")
    When I delete a user I want to set its active field to "N" and then
    when
    someone reads users from the client (after I have saved my changes)I
    want
    only users whoses active field is "Y" to be returns, i.e.
    Client clientA = <read client A>
    Collection users = clientA.getUsers();
    Is there a way to configure/customize the mapping/relationship
    between
    objects?
    Thanks!
    Bruce
    Stephen Kim
    [email protected]
    SolarMetric, Inc.
    http://www.solarmetric.com

  • Diff between object based and ob. oriented

    diff between object based and ob. oriented

    Object-oriented requires at least three factors:
    1. Encapsulation: Combining data and the methods that manipulate the data into a self-contained unit called an "object" in which the data is hidden from the user and only the method interface is visible.
    2. Inheritance: Ability of a class to extend the features of another class by obtaining all the public features of the other class while adding its own specialized features (Example: Great Dane inherits from Dog)
    3. Polymorphism: The ability to perform "late binding" by invoke methods of a subclass on behalf of its superclass. (Polymorphism includes other things and it difficult to explain.
    If a language does not include all three, it is called "object-based." Visual Basic 6 is object-based, because it allows you to define classes that encapsulate, but doesn't support an inheritance hierarchy nor polymorphism.

  • [svn:bz-trunk] 16967: Bug: BLZ-549 - cyclic dependencies between core and remoting projects

    Revision: 16967
    Revision: 16967
    Author:   [email protected]
    Date:     2010-07-19 00:41:00 -0700 (Mon, 19 Jul 2010)
    Log Message:
    Bug: BLZ-549 - cyclic dependencies between core and remoting projects
    QA: Yes
    Doc: No
    Checkintess: Pass
    Details:
    -Removed the unnecessary dependency between core module tests and remoting module. Code module, including its tests, should not depend on any other module other than common module.
    -Remove blazeds-unittests project, instead added a test folder to blazeds-core project.
    -Fixed a minor bug in MessageDestination that I found during JUnit testing.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/BLZ-549
    Modified Paths:
        blazeds/trunk/development/eclipse/projects/java/blazeds-core/.classpath
        blazeds/trunk/development/eclipse/projects/java/blazeds-core/.project
        blazeds/trunk/modules/core/src/flex/messaging/MessageDestination.java
        blazeds/trunk/modules/core/test/src/flex/messaging/DestinationTest.java
        blazeds/trunk/modules/core/test/src/flex/messaging/MessageBrokerTest.java
        blazeds/trunk/modules/core/test/src/flex/messaging/services/AbstractServiceTest.java
        blazeds/trunk/modules/core/test/src/flex/messaging/services/ServiceAdapterTest.java
    Removed Paths:
        blazeds/trunk/development/eclipse/projects/java/blazeds-unittests/.classpath
        blazeds/trunk/development/eclipse/projects/java/blazeds-unittests/.project

  • Increase distance between objects w/o resizing the objects

    Is it posible to increase distance between objects in illustrator cs3 without resizing the individual objects?
    For example, I have a series of circles separated from one another by about 20 pixels, aligned into a grid-like formation.  I would like to increase or decrease the distance of the circles from one another, without changing the size of the circles themselves.
    Thanks,
    Regina

    As Chris said, use the Distribute functions of the Align Palette. Assume a 5 x 5 array of circles separated by 20 points in each direction. You now want the array spacing to be 30 points.
    1. Black Pointer: drag a marquee selection across the top row of 5. Then click once on the leftmost one.
    2. Align Palette: Show Options. In the distance field of the Distribute area, enter 30. Click the Distribute Horiizontally button.
    3. Select and group each of the other four rows.
    4. Select the four rows and one of the top row's circles. Click once again on the selected top row circle.
    5. Align Palette: Make sure the 30 value is still there. Click the Distribute Vertically button.
    JET

Maybe you are looking for

  • Error trying to install windows enterprise 8.1 with bootcamp 5.1.2

    Hi, I have a 64 bit windows iso file for enterprise 8.1  and it is 64 bit I am running the latest bootcamp and getting the following error: "Boot Camp only supports 64-bit Windows installation on this platform. Please use a ISO file for 64-bit Window

  • Trial Version Will Not Run on my Mac

    I have been trying to use the trial of Lightroom 5 to see if I will convert from iPhoto/Aperture to Photoshop/Lightroom.  I belong to a digital photography club and we are evaluating "endorsing" a single platform so we can provide education and train

  • Content Player is not working

    Hi All,

  • Complete code for loading swf file in actionscript 3

    i have a swf file which i want to load into a fla file and export as a new swf file. I understand this part but my actionscript 3.0 code that i put on frame one of the timeline does not work. I have tried every version i have seen online including in

  • Sales Returns Stock posting using movement type 651

    Hi Experts, I want to upload the sales returns stock using movement type 651. Because, our existing company code 'xxxx' has been changed to 'zzzz' and all the stocks, balances and so on has been uploaded and carry forwarded to new company code 'zzzz'