DB 表字段 用了关键字导致error

Prod 环境出了一个ERROR, 还好功能没太多人使用。

原因:之前数据库做了迁移,MYSQL -> SQLSERVER

不知道谁在建表的时候,table 用了 column 'desc' 做为字段名,在mysql 上 select 数据正常。但在sql server 上 select 数据出现 error.

select a.desc from table a where 1=1

必须修改成这个才能运行通过。

select a.[desc] from table a where 1=1

desc明显的关键字,请小心使用。

 

posted @ 2018-02-23 10:18  LatteYan  阅读(130)  评论(0)    收藏  举报