天天看點

sql單引号嵌套

如果執行下面sql語句會報錯, 語句未正常結束。  

update a

set name= 'select XX from b  where XXX = '[Plant]''

where comment1 = 'select XX from b where XXX =[Plant]'

把值裡面的單引号替換為兩個單引号即可

update a

set name= 'select XX from b  where XXX = ''[Plant]'''

where comment1 = 'select XX from b where XXX =[Plant]'