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, WRITETEXT limit is 2048 bytes

Status
Not open for further replies.

faccorp

Programmer
Jan 24, 2002
58
US
Hello,

I have created two stored procedures. One of them uses WRITETEXT to write large of amounts of data to a 'text' field. The other uses 'READTEXT' to read the data.

Here is the write code:

Code:
CREATE PROCEDURE [update_EXTNOTES]

(@idnumber 	[int],
 @Notes 	[ntext])

AS

EXEC sp_dboption 'dbname', 'select into/bulkcopy', 'true'

DECLARE @ptrval binary(16)
SET TEXTSIZE 64000
SELECT @ptrval = TEXTPTR(EXTNOTES) 
FROM CUSTOMERS
WHERE [ID Number] = @idnumber

WRITETEXT CUSTOMERS.EXTNOTES @ptrval @Notes


EXEC sp_dboption 'dbname', 'select into/bulkcopy', 'false'
GO

And the READTEXT sp is

Code:
CREATE PROCEDURE [dbo].[get_EXTNOTES] 
(
	@idnumber 	[int]
)

AS

DECLARE @val varbinary(16)
SET TEXTSIZE 64000
SELECT @val = textptr(EXTNOTES) FROM CUSTOMERS
WHERE [ID Number] = @idnumber
READTEXT CUSTOMERS.EXTNOTES @val 0 0
GO


I can't get this to store more than 2048 characters. Or maybe read more than 2048 characters. I'm not sure which it is. Something is limiting either the storage or reading to 2048 characters.

One thing I noticed, I am using VC 7.0 as my front end. When I use the Class manager for connection to these procedures, it creates a 'm_Notes TCHAR[8000];' variable for the text data for both the read and the write of the text. I guess this is normal, and I will need to bump up the 8000 to something greater eventually, however, why am I limited to 2048?

I saw something about DBTEXTLIMIT and DBTEXTSIZE. But how do I use the dbsetopt function? Where do I call it from?

SELECT @@TEXTSIZE return 64000

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top