NewbiDoobie
Technical User
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
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
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 © 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