Invalid database objects.

  • Hi, can anyone tell me how I can find invalid views and procedures in my database? (SQL2K)

    I know there are some, but need to find them before the yusers do.

     

    thanks

  • Define what you mean by invalid?

    Do you mean they reference columns or tables that do not exist?


    Regards,

    Steve

    Life without beer is no life at all

    All beer is good, some beers are just better than others

  • yes, sorry, that's exactly what I mean.

    I know I have one, definetly, but would like some sort of script to check all procedures and views.

  • Sounds complicated to me as you would need to parse the source for the procedures or views to determine column and table names.

    Once you have a list of those, you could then check for their existence in sysobjects or syscolumns.

    You should probably include calls to other stored procedures as well.

    It's the parsing of the source that will be the difficult part.

    Not something I've done, but that would be my initial approach.


    Regards,

    Steve

    Life without beer is no life at all

    All beer is good, some beers are just better than others

  • Oops, forgot to mention that sp_helptext is the stored proc for getting the source of your views and procedures.

    You might want to include User defined functions as well incase they reference something that is no there


    Regards,

    Steve

    Life without beer is no life at all

    All beer is good, some beers are just better than others

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

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