vrijdag 17 december 2010

T-SQL Checking or column exist in specific table

There are several ways to check or a column exists based on SQL 2008 Server, but I like to be sure that I can use the method on older and newer versions. Now I always use the INFORMATION_SCHEMA for checking existence of columns.


Is this a best practice, most compatible with older and coming version of SQL Server?

Should you use syscolumns or is it sys.columns but the you need to combine to get the result with other system views:


Also this could or has been changed in SQL server edition from the past or in the future.

When you have a better method please let me now!

Geen opmerkingen: