Re: Want to Know Colunm exist or not

From: Anith Sen (anith_at_bizdatasolutions.com)
Date: 05/12/04


Date: Wed, 12 May 2004 11:51:10 -0500

Look up the mata-data function COL_LENGTH in SQL Server Books Online. You
can do:

SELECT CASE WHEN COL_LENGTH ( 'tbl' , 'col' ) IS NULL
            THEN 'Nope' ELSE 'Exists' END ;

You can also check the results of any of the COLUMNPROPERTY functions to see
if it is a NULL to check if the column exists in a table or not.

-- 
Anith