UpdateText 更新SqlServer大对象

exec sp_tableoption N'Excel', 'text in row', 'OFF'

declare excel_cursor cursor local for select f_title,f_from,f_about,f_type,f_filesize,f_filename,f_filetype,f_date,TEXTPTR(f_file) from dbsxcoalcom2005.dbo.excelfile where f_language = 2

declare @Title varchar(200)
declare @From varchar(50)
declare @Keys varchar(50)
declare @CategoryID int
declare @FileSize int
declare @FileName varchar(200)
declare @FileType varchar(50)
declare @InTime smalldatetime
declare @PtrFileSource binary(16)
declare @PtrFile binary(16)

 

open excel_cursor

fetch next from excel_cursor into @Title,@From,@Keys,@CategoryID,@FileSize,@FileName,@FileType,@InTime,@PtrFileSource

WHILE @@FETCH_STATUS = 0
begin
 insert into Excel(Title,AreaID,CategoryID,[From],Keys,FileSize,[FileName],FileType,InTime,[File])
 select @Title,4,@CategoryID,@From,@Keys,@FileSize,@FileName,@FileType,@InTime,'1'

 select @PtrFile = TEXTPTR([File]) from Excel where ID = @@identity

 UPDATETEXT FenWei_En.dbo.Excel.[File] @PtrFile 0 null dbsxcoalcom2005.dbo.excelfile.f_file @PtrFileSource

 fetch next from excel_cursor into @Title,@From,@Keys,@CategoryID,@FileSize,@FileName,@FileType,@InTime,@PtrFileSource
end

close excel_cursor
deallocate excel_cursor

select * from dbsxcoalcom2005.dbo.excelfile where f_language = 2 order by f_date
select * from Excel order by InTime

你可能感兴趣的:(sqlserver)