HOW TO CHECK IF A COLUMN EXISTS IN SQL SERVER TABLE?

Manish Sahu

Total Post:47

Points:331
Posted by  Manish Sahu
 507  View(s)
Ratings:
Rate this:

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

  1. Sunil Singh

    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. AMANDEEP SINGH

    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

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!