|   | ![]() |
|
How can I tell if a column for
a table already exists? There are two ways (with SQL 7) :- IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '<tbl>' AND COLUMN_NAME = '<col>') or if columnproperty (object_id('<tbl>'), '<col>', 'AllowsNull') IS NOT NULL |
All content on this site, except where noted, represents an original work of Michael R. Hotek and is protected by applicable copyright laws. The SQL Server FAQ is the sole work of Neil Pike. No page, portion of a page, or download may be used for commercial purposes in whole or in part without the express, written permission of the applicable author.