insert into file (file_ip, file_doc) values ('192.168.1.125', 'C:\Documents and Settings\'\桌面\方案.doc')这句insert里file_doc是文件的路径,但文件路径C:\Documents and Settings\'\桌面\方案.doc中间出现了一个'号,insert就不能执行了..这该怎么解决?

解决方案 »

  1.   

    你想怎么搞?两个代替一个..
    or
    REPLACE去掉?
      

  2.   

    insert into file (file_ip, file_doc) values ('192.168.1.125', 'C:\Documents and Settings\''\桌面\方案.doc') 
      

  3.   

    insert into file (file_ip, file_doc) values ('192.168.1.125', replace('C:\Documents and Settings\'\桌面\方案.doc','''','''''')) 
      

  4.   

    --insert into file (file_ip, file_doc) values ('192.168.1.125', 'C:\Documents and Settings\'\桌面\方案.doc') 
    declare @t table(ip varchar(30),path varchar(50))
    insert @t select '192.168.1.125', 'C:\Documents and Settings\''\桌面\方案.doc'
    select * from @t
    /*
    ip                             path                                               
    ------------------------------ -------------------------------------------------- 
    192.168.1.125                  C:\Documents and Settings\'\桌面\方案.doc*/
      

  5.   


    insert into file (file_ip, file_doc) values ('192.168.1.125', ''C:\Documents and Settings\''\桌面\方案.doc'') 
      

  6.   

    insert into file (file_ip, file_doc) values ('192.168.1.125', 'C:\Documents and Settings\''\桌面\方案.doc')