Losing dependencies when changing table schema

  • I need to change the data type of one of my table fields from MONEY to DECIMAL(20,5). Before making the change I did View Dependencies on the table and it listed one view (vwOrderDetails).

    So I went into the table designer, changed the field and viewed the Change Script that was generated by SSMS. It had a bunch of ALTER VIEW statements on about 10 other VIEWs. Probably because they all depend on the first view.

    I also previously ran three other stored procedures to make sure I didn't miss any other dependencies (like sp_depends etc...).

    Since everything looked ok, I decided to run the change script that SSMS generated. After I ran the script, View Dependencies did not list any dependencies anymore, even though I know at least one exists.

    vwOrderDetails is still there and it depends on tblOrderDetails.

    Can someone explain why this happens?

    Thanks

    Ray

  • Because the dependency viewing in SQL Server is more than a little bit messed up. Try running a query against sys.dm_referencing_entities to get the objects that are referring to the table. You can also use sys.dm_referenced_entitities the other direction.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • I believe those are specific to SQL2008, I'm using SQL2005.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply