How to escape single quotes in Sybase

后端 未结 2 2229
花落未央
花落未央 2021-02-19 05:49

I come from MySQL and the below query doesn\'t work in Sybase. How should I escape single quotes?

UPDATE Animals SET NAME = \'Dog\\\'s friends\' WHERE uid = 12
<         


        
2条回答
  •  梦毁少年i
    2021-02-19 06:38

    If working with Sybase, having got used to MySQL which more database users have experience you may soon discover you are unable to escape single quotes with backslash in.

    So how do you escape quotes in Sybase? In fact, in Sybase SQL the single quote acts as the escape character.

    See below for an example UPDATE statement in both “languages”:

    MySQL

    UPDATE Animals SET NAME = 'Dog\'s friends' WHERE uid = 12
    

    Sybase

    UPDATE Animals SET NAME = 'Dog''s friends' WHERE uid = 12
    

    I’m not entirely sure this makes sense to me (especially as it looks like a double quote) but there you go!

提交回复
热议问题