Recompiling SPs in SQL server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sunil

    Recompiling SPs in SQL server

    Hi Group,

    I have a database which has around 2000 SPs. I dont have relationships
    defind in the database as its a maintainence project so now I want to
    recomiple each SP so to know that the SPs are in correct state. One
    way is to use sp_recomiple system stored procedure but it will only
    recomiple the SP when the SP is called. I want the SPs to get
    recompiled and report me errors in the SPs.

    I dont want to change the SP by WITH RECOMPILE option since that will
    also mean changing all SPs. and every other option i found only works
    when the SP is called. I cannot write EXEC <SP NAME> since it means
    providing parameters for the SPs and its a very tidious task.

    Can anyone suggest me some easier way to do it ??

    Thanks in advance
    Sunil
  • Simon Hayes

    #2
    Re: Recompiling SPs in SQL server


    "Sunil" <sunil_is_cool@ hotmail.com> wrote in message
    news:bd178c45.0 311060007.7ea8a eb0@posting.goo gle.com...[color=blue]
    > Hi Group,
    >
    > I have a database which has around 2000 SPs. I dont have relationships
    > defind in the database as its a maintainence project so now I want to
    > recomiple each SP so to know that the SPs are in correct state. One
    > way is to use sp_recomiple system stored procedure but it will only
    > recomiple the SP when the SP is called. I want the SPs to get
    > recompiled and report me errors in the SPs.
    >
    > I dont want to change the SP by WITH RECOMPILE option since that will
    > also mean changing all SPs. and every other option i found only works
    > when the SP is called. I cannot write EXEC <SP NAME> since it means
    > providing parameters for the SPs and its a very tidious task.
    >
    > Can anyone suggest me some easier way to do it ??
    >
    > Thanks in advance
    > Sunil[/color]

    Your desciption is a little unclear, but I suspect that maybe you want to
    recreate the procedures to check that the syntax is valid, not recompile or
    execute them - those are three different things. If so, one option is to
    script all the procedures to a file using Enterprise Manager, then run the
    file (preferably in a test database), and review the output. You could use
    osql.exe to do this, and send the output to a file for easier viewing.

    If I've misunderstood you, could you explain exactly what you mean by "in a
    correct state"? Also, it would be useful to know which version of SQL Server
    you have, as deferred name resolution means that your stored procedures may
    be (re)created successfully, but will not execute due to missing objects.

    Simon


    Comment

    Working...