Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

readtext?

Status
Not open for further replies.

NewbiDoobie

Technical User
Jul 25, 2005
63
US
I have a text field that I am updating. Once the procedure finishes running i need to save it to a file.


The problem is that I am getting about half of the document.

Here is my code

Code:
set nocount on

declare @Abbr table ( IDN int identity
			, Abbreviation varchar(12)
			, Definition  varchar (80)
			)

insert into @abbr (Abbreviation, Definition)
select ABREVIATIO,DEFINITION from dbo.ABBR order by ABREVIATIO 


--select * from @Abbr



create table #storagetable 
	(HTML text)


Declare @HTMLStart varchar(8000)
	,@HTMLBody varchar(8000)
	,@HTMLEnd varchar(8000)
	,@abr1 varchar(12)
	,@abr2 varchar(12)
	,@Def1 varchar(80)
	,@Def2 varchar(80)
DECLARE @ptrval binary(16)
	,@finalid int


Declare @TableName varchar(150)
Set @TableName = 'Motor Abbreviations'
Declare @copyright varchar(255)
	set @copyright = '<TD align=Center Size-6 Colspan =5 nowrap\><FONT>Copyright &copy; 2005  All rights reserved.</font></TD>'

Declare @caption varchar(255)
	Select @Caption = '<caption>Excluding lubricant and footnote symbols, and model nomenclature. These abbreviations may be punctuated.</caption>'

Declare @header varchar(200)
set @header = '<html><head><title>' +  @TableName + '</title> Motor Abbreviations  </head><body>'

set @HTMLStart = @header + '<table>'+ @caption 
set @HTMLEnd = '<tr>'+   @copyright + '</tr>' + '</table></body></html>'



insert into #storagetable
	(HTML )
select   @HTMLStart 
--print @HTMLStart
declare Processing1 cursor for select top 179  a.Abbreviation, a.Definition,  b.Abbreviation, b.Definition
				from @Abbr a left outer join 
				@Abbr b on 
				a.idn + 179 = (b.idn)
open Processing1

fetch next from Processing1 into
	@abr1 
	,@Def1
	,@abr2
	,@Def2 


while @@fetch_status = 0 
begin 


set @HTMLBody = ''
set @HTMLBody = @HTMLBody + '<tr> ' 
+ dbo.TD('Left',isnull(@abr1, '-')) 
+ dbo.TD('Left',isnull(@Def1, '-')) 
+ dbo.TD('Left',isnull(@abr2, '-')) 
+ dbo.TD('Left',isnull(@Def2, '-')) 
+ '</tr>'

--print @HTMLBody
-----------------------------------------------------------------------------------------------------

SELECT @ptrval = TEXTPTR(HTML) FROM #storagetable 
UPDATETEXT #storagetable.HTML @ptrval null 0 @HTMLBody  


set @HTMLBody = ''
-------------------------------------------------------------------------------------------------




fetch next from Processing1 into
	@abr1 
	,@Def1 
	,@abr2 
	,@Def2 
select 	@abr1 
	,@Def1 
	,@abr2 
	,@Def2 


end
deallocate Processing1
SELECT @ptrval = TEXTPTR(HTML) FROM #storagetable 
UPDATETEXT #storagetable.HTML @ptrval null 0 @HTMLEnd  

DECLARE @Val varbinary(16)
SELECT @Val = TEXTPTR(HTML) FROM #storagetable 
READTEXT [#storagetable].[HTML] @Val 0 24456


drop table #storagetable

why can I only see the first half of the document?

The text string is 24456 characters and if I set it any higher it gives me an error that i set it too high
 
What is the value of select @@TEXTSIZE?

What do you get back if you do select HTML from #storagetable?

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top