Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 985469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:10:09+00:00 2026-05-16T05:10:09+00:00

There appears to be several stored procedures that were renamed with sp_rename, causing the

  • 0

There appears to be several stored procedures that were renamed with sp_rename, causing the syscomments to be left with the old proc name instead of the new proc name.

Thus, my db transfers are failing to transfer correctly.

Is there a way to find which procs (or any objects) have their names out of synch?

Or better, a simple way to find AND fix them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:10:09+00:00Added an answer on May 16, 2026 at 5:10 am

    You could try

    select object_name(id)
    from syscomments 
    WHERE COLID=1 AND
    OBJECTPROPERTY(id, 'isprocedure')=1 and
    REPLACE(REPLACE(TEXT,CHAR(13),' '),CHAR(10),' ') 
              NOT LIKE '%CREATE%PROC%'+ object_name(id) + ' %'
    AND
    (REPLACE(REPLACE(TEXT,CHAR(13),' '),CHAR(10),' ')
              NOT LIKE '%CREATE%PROC%'+ object_name(id) + ']%')
    

    SYS.SQL_MODULES would probably be slightly more robust if there is a risk that you’ve got some 4,000 character comment before the CREATE PROC bit.

    A more robust solution than parsing the text yourself though would be to generate a script to run to recompile all your stored procedures. If you run the below…

    SELECT 'EXEC sp_refreshsqlmodule ''' + 
                quotename(schema_name(schema_id)) + '.' + 
                quotename(object_name(object_id)) + '''' 
    FROM sys.procedures
    

    …then copy and paste the results into a management studio query window and execute the resultant script it will give you an error for ones where the names are out of synch.

    This will cause all your stored procedure plans to be recompiled so don’t do this on a production server if that’s an issue.

    Edited to provide Additional Information about a bug.

    The code in the answer above should not be used if there is any possibility that sp_rename has been used to swap the definition of two objects. sp_refreshsqlmodule apparently has a bug in that situation!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an option to enable the drop down menu that appears when coding
Is there an event that fires in vb.net just before a contextMenuStrip appears when
It appears that ffmpeg now has a segmenter in it, or at least there
There's this bar that appears at the top, with an app's icon and a
module name: module references __file__ This appears several times when I install my own
In CruiseControl.NET there appears to be the same xsl stylesheets in the server directory
In the AS3 XML class there appears to be two ways of getting the
I am working on a .NET application where there appears to be a memory
From the answers to this question it appears there's a file somewhere on our
Is there any way to convert the image so it appears as a gray

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.