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

  • Home
  • SEARCH
  • 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 3480528
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:21:46+00:00 2026-05-18T10:21:46+00:00

Microsoft SQL Server seems to check column name validity, but not table name validity

  • 0

Microsoft SQL Server seems to check column name validity, but not table name validity when defining stored procedures. If it detects that a referenced table name exists currently, it validates the column names in a statement against the columns in that table. So, for example, this will run OK:

CREATE PROCEDURE [dbo].[MyProcedure]
AS
BEGIN
    SELECT
        Col1, Col2, Col3
    FROM
        NonExistentTable
END
GO

… as will this:

CREATE PROCEDURE [dbo].[MyProcedure]
AS
BEGIN
    SELECT
        ExistentCol1, ExistentCol2, ExistentCol3
    FROM
        ExistentTable
END
GO

… but this fails, with ‘Invalid column name’:

CREATE PROCEDURE [dbo].[MyProcedure]
AS
BEGIN
    SELECT
        NonExistentCol1, NonExistentCol2, NonExistentCol3
    FROM
        ExistentTable
END
GO

Why does SQL Server check columns, but not tables, for existence? Surely it’s inconsistent; it should do both, or neither. It’s useful for us to be able to define SPs which may refer to tables AND/OR columns which don’t exist in the schema yet, so is there a way to turn off SQL Server’s checking of column existence in tables which currently exist?

  • 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-18T10:21:46+00:00Added an answer on May 18, 2026 at 10:21 am

    This is called deferred name resolution.

    There is no way of turning it off. You can use dynamic SQL or (a nasty hack!) add a reference to a non existent table so that compilation of that statement is deferred.

    CREATE PROCEDURE [dbo].[MyProcedure]
    AS
    BEGIN
    
    CREATE TABLE #Dummy (c int)
    
        SELECT
            NonExistantCol1, NonExistantCol2, NonExistantCol3
        FROM
            ExistantTable 
        WHERE NOT EXISTS(SELECT * FROM #Dummy)    
    
    
    DROP TABLE #Dummy
    
    END
    GO
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not quite sure what's going on here but it seems as though Microsoft always
Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring
Microsoft SQL Server has a nice feature, which allows a database to be automatically
In Microsoft SQL Server, is there a way to detect whether a database has
Using Microsoft SQL Server's database mirroring capability, can the mirroring occur between two clusters?
We have a Microsoft SQL Server 2005 database that needs to be converted back
Working with Microsoft SQL Server I found extremely useful SQL Server Profiler and Estimated
I've just installed Microsoft SQL Server Express 2008 (with Reporting Services). My installation is
I need to reverse engineer a Microsoft SQL Server 2008 in order to create
I have a connection to a Microsoft SQL Server and want the change the

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.