|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Requesting help on READTEXT statement
Greetings,
I am using a READTEXT statement within a stored procedure to extract a blob of text that has been stored as a binary image. I need to then convert that binary representation back to Ascii. My question is.... is there a way to assign the 'returned' binary from the READTEXT statement to a variable so that I may use the variable in the CONVERT statement? I then need to have the Ascii result of the CONVERT command assigned to a variable for return to the calling routine. Here is an example of the code I have been trying to create. DECLARE @bodyID uniqueidentifier DECLARE @chunkindex int DECLARE @chunksize int DECLARE @myval varchar(8000) DECLARE @val binary(16) DECLARE @chunkText varchar(8000) OUTPUT SET @bodyID = '{77E9D68C-9985-4365-8580-FFFC82553562}' SET @chunkindex = 0 SET @chunksize = 2597 SELECT @val = TEXTPTR(chunkdata) FROM relaystorebodychunks WHERE bodyid = @bodyID order by chunkid READTEXT relaystorebodychunks.chunkdata @val @chunkindex @chunksize SET @myval = [READTEXT RESULT VARIABLE] SELECT CONVERT(char(8000), @myval) RETURN @chunkText The code above is taken from a stored procedure. [READTEXT RESULT VARIABLE] represents a variable which holds the result of the READTEXT statement. RETURN @chunkText represents an Ascii translation of the stored data to be returned to the calling program. I have attempted to use statements such as "SET @myvar = READTEXT relaystorebodychunks.chunkdata @val @chunkindex @chunksize" and "SET @chunkText = SELECT CONVERT(char(8000), @myval)" however doing so returns errors on the READTEXT statement and the CONVERT statement respectively. |
|
#2
|
|||
|
|||
|
Can't help - sorry
I note it was a long time ago since you posted the email. Unfortunately I can't help as I have precisely the same problem. Did you ever resolve it?
Just to let you know there are others out there. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Requesting help on READTEXT statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|