select * from 表 where charindex(cast(ProductID as varchar(50))+'.',PicFile)<>1

解决方案 »

  1.   

    select ProductID from Products where left(PicFile,len(cast(ProductID as varchar(10))))=cast(ProductID as varchar(10))
      

  2.   

    Select * From Table Where PicFile <> '' And PicFile not is null
      

  3.   

    select * from table2
    where( charindex(cast(ProductID as varchar(50))+'.',PicFile)<>1 and 
    charindex(cast(ProductID as varchar(50))+'-',PicFile)<>1) or 
    right(isnull(PicFile,''),4)<>'.jpg'
      

  4.   

    select * from table2
    where( charindex(cast(ProductID as varchar(50))+'.',PicFile)<>1 and 
    charindex(cast(ProductID as varchar(50))+'-',PicFile)<>1) or 
    right(isnull(PicFile,''),4) not in ('.jpg','.bmp')
      

  5.   

    select * from 表 where charindex(cast(ProductID as varchar(50)),PicFile)<>1因为11111-1.jpg、22222-3.bmp也被视为正确的