Sybase 插入语句的字段值有分隔符“'”的解决方案
问题场景
往Sybase库插入数据的时候,有一个字段的值是要存入SQL语句,含有分隔符“’”,如何正确地插入语句?
解决方案
在字段的值当中,将分隔符中加多一个,那么就可以顺利插入
示例
错误样例
insert into test(a,b) values (1,"delete from tableA where name='s' ");
insert into test(a,b) values (1,'delete from tableA where name='s' ');
正确示例
insert into test(a,b) values (1,'delete from tableA where name=''s'' ');
浙公网安备 33010602011771号