select ProductID from Products where left(PicFile,len(cast(ProductID as varchar(10))))=cast(ProductID as varchar(10))
Select * From Table Where PicFile <> '' And PicFile not is null
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'
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')
select * from 表 where charindex(cast(ProductID as varchar(50)),PicFile)<>1因为11111-1.jpg、22222-3.bmp也被视为正确的
where( charindex(cast(ProductID as varchar(50))+'.',PicFile)<>1 and
charindex(cast(ProductID as varchar(50))+'-',PicFile)<>1) or
right(isnull(PicFile,''),4)<>'.jpg'
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')