神句

来源:互联网 发布:33选6的所有组合数据 编辑:程序博客网 时间:2024/04/28 23:37
USE [NBHDB]GO/****** Object:  StoredProcedure [dbo].[SaveImg]    Script Date: 04/30/2014 13:45:30 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[SaveImg]ASBEGINdeclare @cc int,@i int,@str nvarchar(max),@a int,@c int,@temp nvarchar(max),@id int,@imgs nvarchar(max)set @i=1;set @a=1;set @id=0;set @imgs='';select @cc=(select COUNT(*) from Product where img<>'' and img is not null)create table #yy(col nvarchar(50))while(@i<=@cc)beginset @str=(select top 1 img from BaseOfMovie where img<>'' and img is not null and id not in(select top (@i-1) id from BaseOfMovie where img<>'' and img is not null))insert into #yy select * from f_split(@str,',')set @c=(select COUNT(*) from #yy)while(@a<=@c)beginset @temp=(select top 1 * from #yy where col not in(select top (@c-1) * from #yy))print @tempinsert into images(path)values(@temp) set @id=@@IDENTITYprint @idset @imgs=','+CAST(@id as nvarchar(50))+@imgsset @a=@a+1print '插入img成功'endset @imgs=SUBSTRING(@imgs,2,LEN(@imgs)-1)if(@imgs<>'')beginupdate BaseOfMovie set img=@imgs where img=@strprint '成功'endprint @imgsset @imgs='';set @a=1;delete from #yyset @i=@i+1end

0 0