如题,如何把表中一个字段的所有图片路径全部都读出来?
例如:<img width="10" height="10" src="/PointForum/ui/images/blank.gif" />
我把要一个字段中所有的img标签的路径/PointForum/ui/images/blank.gif读出来,
这个字段还有其他的内容,也有的是多张图片sql 可以完成吗?谢谢

解决方案 »

  1.   

    declare @t table(Id int identity(1,1),[Path] varchar(100))
    insert @t select '/PointForum/ui/images/blank.gif'
    select * from @t where [path]='/PointForum/ui/images/blank.gif'
    如果不对
    帮你顶,等待高人~~
      

  2.   

    declare @t table(Id int identity(1,1),[Path] varchar(100)) 
    insert @t select '<img width="10" height="10" src="/PointForum/ui/images/blank.gif" />' 
    insert @t select '<img width="10" height="10" src="/PointForum/ui/images/blank1.gif" />' select substring(path ,charindex('src="',path)+5 ,len(path) - charindex('src="',path) - 8)
    from @t /*
                                                                                                         
    ---------------------------------------------------------------------------------------------------- 
    /PointForum/ui/images/blank.gif
    /PointForum/ui/images/blank1.gif(所影响的行数为 2 行)
    */
      

  3.   

    要查记录, 还是要得到文件名? 还是要做什么?如果只是查记录, 可以直接用条件:
    WHERE 列名 like '%<img %src="/PointForum/ui/images/blank.gif" />%' 
      

  4.   


    declare @t table(Id int identity(1,1),[Path] varchar(100)) 
    insert @t select '<img width="10" height="10" src="/PointForum/ui/images/blank.gif" />' 
    insert @t select '<aa src="/abc.txt"><img width="10" height="10" src="/PointForum/ui/images/blank1.gif" />' 
    insert @t select '<img width="10" src="/PointForum/ui/images/blank2.gif" height="10" />' select id,substring(path,src_i+5,charindex('"',[path],src_i+5)-src_i-5) as [path]
    from (select *,charindex('src=',[path],charindex('<img',[path])) as src_i
             from @t 
            ) a/*
    id          path
    ----------- ----------------------------------
    1           /PointForum/ui/images/blank.gif
    2           /PointForum/ui/images/blank1.gif
    3           /PointForum/ui/images/blank2.gif(3 行受影响)
    */