haopic
V2EX  ›  问与答

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

  •  
  •   haopic · Dec 23, 2014 · 2501 views
    This topic created in 4348 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
    zts1993
    Dec 23, 2014
    1
    '<a onclick="online('index_article');return false;"'


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