How to Check if a Column Exists in SQL Server Table?

Total Post:52

Points:366
 736  View(s)
Ratings:
Rate this:

how can I check if a column exist in sql server table

  1. Post:45

    Points:323
    Re: How to Check if a Column Exists in SQL Server Table?

    You can try this ,hope this helps you.

    IF EXISTS 
    (
        SELECT * 
        FROM INFORMATION_SCHEMA.COLUMNS 
        WHERE table_name = 'Student'
        AND column_name = 'Name'
    )
        PRINT 'Column Exists'
    ELSE
        PRINT 'Column doesn''t Exists'

      Modified On Nov-13-2017 06:44:04 AM
  1. Post:9

    Points:37
    Re: How to Check if a Column Exists in SQL Server Table?

    Thanks for the help, Mr. sunil.

      Modified On Apr-11-2018 11:28:40 PM

Answer