With Schemabinding error message

  • I need to alter some views. I use schemabinding a lot, and when I change a view, I frequently run into this sort of error message:

    Cannot ALTER 'BotCBO.vwClovekNameStrings_PrZk' because it is being referenced by object 'vwTableOfPublicationTitlesList'.

    Nice enough, but the message doesn't include the schema of the offending object. With multiple schemas, finding which schema contains the problem can be a nuisance. Is there some way to get this information? Seems completely retarded that the SQL boyz left something as fundamental as the schema off, but that's what I'm getting. is there maybe a setting somewhere that make SQL Server include that information in the message? That would be best, but at least having some way to find this would help.

    Naturally, I can use code like

    SELECT 
    OBJECT_SCHEMA_NAME(v.object_id) schema_name,
    v.name
    FROM
    sys.views as v

    to locate all views with a particular name, but that still doesn't tell me which of the (possibly) multiple views with the same name are causing my problem. Besides that, running such a query is a pain, and shouldn't be necessary. The error message should provide this information.

    • This topic was modified 4 years, 7 months ago by  pdanes.
  • Try:

    EXEC sys.sp_depends 'BotCBO.vwClovekNameStrings_PrZk'

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

  • Ah, that looks useful. Thank you.

  • Considering they are just now in SQL 2019 getting around to showing the column throwing a truncation error which is far more annoying than having to sort through a handful of views......

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

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