haopic
V2EX  ›  问与答

这条 SQL 怎么写?一条更新语句

  •  
  •   haopic · Dec 23, 2014 · 2204 views
    This topic created in 4172 days ago, the information mentioned may be changed or developed.
    update dbo.PE_U_Article set Content=replace(cast(Content as varchar(8000)) ,'<a','<a onclick="online('index_article');return false;"') where Content in (Select top 10 Content from dbo.PE_U_Article)

    报错:
    消息 102,级别 15,状态 1,第 1 行
    'gc027_article_WZ' 附近有语法错误。
    应该是引号,双引号没嵌套正确。
    5 replies    2014-12-23 17:05:59 +08:00
    zts1993
        1
    zts1993  
       Dec 23, 2014
    '<a onclick="online('index_article');return false;"'


    明显的。。。
    haopic
        2
    haopic  
    OP
       Dec 23, 2014
    @zts1993 这个怎么调一下?
    zakokun
        3
    zakokun  
       Dec 23, 2014
    插入html内容怎么说也得转义吧.
    ccbikai
        4
    ccbikai  
    PRO
       Dec 23, 2014
    @haopic 转义啊 SQL转义,自己搜搜方法
    zts1993
        5
    zts1993  
       Dec 23, 2014
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1174 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 17:52 · PVG 01:52 · LAX 10:52 · JFK 13:52
    ♥ Do have faith in what you're doing.