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 842311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:56:24+00:00 2026-05-15T05:56:24+00:00

In sql server how difficult would it be to determine what procedures/functions no longer

  • 0

In sql server how difficult would it be to determine what procedures/functions no longer compile? In other words, if I scripted out alter statements for all procedures and functions in a database, I’d like to know which of these statements are going to fail?

I’ve been working on cleaning up a database I’ve inherited which has gone through years of changes and I’d like to what objects are going to raise errors when something tries to execute it.

  • 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-15T05:56:24+00:00Added an answer on May 15, 2026 at 5:56 am

    Try this

    Call sp_refreshsqlmodule on all non-schema bound stored procedures:

    DECLARE @template AS varchar(max) 
    SET @template = 'PRINT ''{OBJECT_NAME}'' 
    EXEC sp_refreshsqlmodule ''{OBJECT_NAME}'' 
    
    ' 
    
    DECLARE @sql AS varchar(max) 
    
    SELECT  @sql = ISNULL(@sql, '') + REPLACE(@template, '{OBJECT_NAME}', 
                                              QUOTENAME(ROUTINE_SCHEMA) + '.' 
                                              + QUOTENAME(ROUTINE_NAME)) 
    FROM    INFORMATION_SCHEMA.ROUTINES 
    WHERE   OBJECTPROPERTY(OBJECT_ID(QUOTENAME(ROUTINE_SCHEMA) + '.' 
                                     + QUOTENAME(ROUTINE_NAME)), 
                           N'IsSchemaBound') IS NULL 
            OR OBJECTPROPERTY(OBJECT_ID(QUOTENAME(ROUTINE_SCHEMA) + '.' 
                                        + QUOTENAME(ROUTINE_NAME)), 
                              N'IsSchemaBound') = 0 
    
            EXEC ( 
                  @sql 
                ) 
    

    This works for all views, functions and SPs. Schemabound objects won’t have problems and this can’t be run on them, that’s why they are excluded.

    Note that it is still possible for SPs to fail at runtime due to missing tables – this is equivalent to attempting to ALTER the procedure.

    Note also that just like ALTER, it will lose extended properties on UDFs – I script these off and restore them afterwards.

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

Sidebar

Related Questions

The big question is are there any built in SQL Server 2005 functions to
I'm using SQL Server and I'm having a difficult time trying to get the
I would like to write a simple SELECT statement in SQL Server 2005 which
Need help with this SQL Server 2000 procedure. The problem is made difficult because
I am having difficulty connecting my java code to sql server database. I can
SQL Server 2005 I have an SQL Function (ftn_GetExampleTable) which returns a table with
SQL Server 2008 Profiler always profiles all databases. I want to restrict profiling or
SQL Server doesn't support the SELECT FOR UPDATE syntax, which is used by NHibernate
SQL Server a stored procedure written in C# on the .NET 2.0 framework that
SQL Server 2005 Profiler shows that a Stored Procedure (SP) was called and what

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.