How to check if a column exists in a table in Sql Server 2008?
This question already has an answer here:
尝试这个:
SELECT t.name as TabName
,c.name as ColName
FROM sys.columns c
INNER JOIN sys.tables t on c.object_id = t.object_id
WHERE c.name like '%COLUMN_NAME%'
AND t.name = 'TABLE_NAME'
链接地址: http://www.djcxy.com/p/94404.html
上一篇: 如果它尚不存在,请将一列添加到表中