将没有产品图片的产品设置为不在前台显示SQL实现

--select * from Product where ProCode='DWIHEE00108'

--declare @result int
--
exec xp_fileexist 'C:\test\testsdfs.txt',@result output 

--select @result

declare @result int,@proid uniqueidentifier,@proimgurl1 nvarchar(100)

declare myCursor cursor for
    
select proid,proimgurl1 from product
    
open myCursor
fetch myCursor into @proid,@proimgurl1

while @@FETCH_STATUS=0
begin
set @proimgurl1='C:/Project/website/DowellinWebsite'+@proimgurl1
exec xp_fileexist @proimgurl1,@result output 
if (@result=1)
    
update Product set IsShow=1 where ProId=@proid
else
    
update Product set IsShow=0 where ProId=@proid
fetch myCursor into @proid,@proimgurl1
end
close myCursor
deallocate myCursor
原文地址:https://www.cnblogs.com/seerlin/p/2043018.html