Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2005
    Posts
    79

    Unanswered: Looking for schema validation tool

    Hi,

    I have a lot of views and stored procedures that I would like to validate against the database. I'm making a lot of changes to the tables and using SCHEMABINDING is really not an option, but I need to be able to check if the changes I make break anything. Maybe a generic script that goes through all the views and procedures or some tool can do the job?

    Thanks

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    you can use sp_depends or query the sysobjects joined to syscomments (SQL 2000) or sys.sysobjects and sys.syscomments (SQL 2K5). IF you are using source control for your database objects, you can use a "find in files" feature.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    The attached script recompiles database code and flags (most) errors.
    Will not work on versions earlier than 2005. Not tested on 2008.
    Attached Files Attached Files
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Jun 2005
    Posts
    79
    Thank you very much. Works great!

  5. #5
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    beware of procs that reference objects that don't exist. You can create such a proc without compile errors because the query plan for a proc is not computed until the first time it's called.

    I didn't try it, but it's not clear to me that blindman's script will catch those since it doesn't actually call the procs.

    you can still catch errors like that if you call the the proc with SET FMTONLY ON first, but you'd have to add code to call the proc with suitable dummy params.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •