SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GOALTER proc sp_nrc_pattern_body /*this procedure is for the report ID:NRC002 Other procedure sp_uploadpicwithpath: upload the pictures to database */ ASdeclare @fname_in varchar(1000) ,@m_tbname varchar(50) --the name of the temporary table ,@sql varchar(8000) ,@fname varchar(1000) --catalogue and file name,the procedure need use ,@pattern_id_tmp intDECLARE @RC int , @rtncode int--get the size of the duct into filecreate table #pic (img image)create table #nrc_pattern_tmp ( nrc_pattern_id int, nrc_pattern_name nvarchar(30), nrc_pattern_desc nvarchar(60), nrc_pattern_path nvarchar(250), nrc_pattern_active_ind varchar(1), img image)insert into #nrc_pattern_tmp( nrc_pattern_id , nrc_pattern_name, nrc_pattern_desc, nrc_pattern_path, nrc_pattern_active_ind) select nrc_pattern_id , nrc_pattern_name, nrc_pattern_desc, nrc_pattern_path, nrc_pattern_active_ind from nrc_pattern where nrc_pattern_type=‘1‘ order by nrc_pattern_group_id,nrc_pattern_namedeclare cur_nrc_pattern cursor for select nrc_pattern_id,nrc_pattern_path from #nrc_pattern_tmp open cur_nrc_pattern fetch cur_nrc_pattern into @pattern_id_tmp, @fname while @@fetch_status = 0 begin --create the data process answer file set @m_tbname=‘[##temp‘+cast(newid() as varchar(40))+‘]‘ set @rtncode = 0 exec @rc = sp_uploadpicwithpath ‘#pic‘, @m_tbname, @fname,@rtncode output if @rtncode = 0 and @rc = ‘0 ‘ begin --duct the data into the formally table set @sql=‘update #nrc_pattern_tmp‘ +‘ set img=b.img‘ +‘ from #nrc_pattern_tmp a,‘ +@m_tbname +‘ b‘ +‘ where a.nrc_pattern_id =‘ + convert(char(4),@pattern_id_tmp) exec(@sql) --drop the temp table @m_tbname set @sql=‘drop table ‘+@m_tbname exec(@sql) end fetch cur_nrc_pattern into @pattern_id_tmp, @fname end close cur_nrc_pattern deallocate cur_nrc_pattern set @sql=‘select nrc_pattern_name , nrc_pattern_desc , nrc_pattern_active_ind, img from #nrc_pattern_tmp‘ exec(@sql) --set @sql=‘select nrc_pattern_path from NRC_PATTERN -- join p_test -- on nrc_pattern_path.pic=p_test.pic‘ -- exec(@sql) set @sql=‘drop table #pic‘ exec(@sql) set @sql=‘drop table #nrc_pattern_tmp‘ exec(@sql)GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO
GO
SET ANSI_NULLS ON
GO
ALTER proc sp_nrc_pattern_body
/*this procedure is for the report ID:NRC002
Other procedure sp_uploadpicwithpath: upload the pictures to database
*/
AS
declare @fname_in varchar(1000)
,@m_tbname varchar(50) --the name of the temporary table
,@sql varchar(8000)
,@fname varchar(1000) --catalogue and file name,the procedure need use
,@pattern_id_tmp int
DECLARE @RC int ,
@rtncode int
--get the size of the duct into file
create table #pic (img image)
create table #nrc_pattern_tmp (
nrc_pattern_id int,
nrc_pattern_name nvarchar(30),
- 生活墨墨2013-01-04好像看不懂,不知道什么意思。
- 粉丝: 882
- 资源: 2万+
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助