Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Determining if a field exists in a table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-03-07 : 07:46:06
John writes "I would like to determine whether a certain field exists in a table before running an UPDATE statement. This table is always built dynamically based on the contents of an import file which varies in format. How do I check for the existence of a certain field in a table?"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-03-07 : 08:07:06

If col_Length('TableName','ColumnName') is not null
'Column exists. Do updatation
else
'Column does not exist


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -