5 pts.
 How to check the existence of a Column in SQL Server 2000?
- using SQL Server 2000 , Would like to know how to check any specific column exist in a database. Any method to search through the list of tables in a database. Thanks.

Software/Hardware used:
ASKED: January 9, 2009  9:30 AM
UPDATED: January 12, 2009  9:35 PM

Answer Wiki:
Try this: <pre>select sysobjects.name from syscolumns left join sysobjects on sysobjects.id = syscolumns.id where syscolumns.name = 'FieldName' and sysobjects.type = 'U' order by 1</pre> Or this <pre>SELECT name FROM syscolumns WHERE name = 'YourColumnName' and id = object_id('YourTable')</pre> A standard way: <pre>select table_name, column_name from information_schema.columns where column_name='YourColumnName'</pre>
Last Wiki Answer Submitted:  January 12, 2009  9:35 pm  by  Denny Cherry   64,505 pts.
All Answer Wiki Contributors:  Denny Cherry   64,505 pts. , carlosdl   63,535 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _