问题:
I need to add a specific column if it does not exist. 如果它不存在,我需要添加一个特定的列。 I have something like the following, but it always returns false: 我有类似以下内容,但始终返回false:
IF EXISTS(SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'myTableName'
AND COLUMN_NAME = 'myColumnName')
How can I check if a column exists in a table of the SQL Server database? 如何检查SQL Server数据库表中是否存在列?
解决方案:
参考一: https://stackoom.com/question/Ybf/如何检查SQL-Server表中是否存在列参考二: https://oldbug.net/q/Ybf/How-to-check-if-a-column-exists-in-a-SQL-Server-table
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/4470056