SunQuest
           MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old October 13th, 2003, 02:30 PM
hdokes hdokes is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Midwest
Posts: 1 hdokes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to hdokes
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.

Reply With Quote
  #2  
Old March 19th, 2004, 08:53 AM
BasicInc BasicInc is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 BasicInc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Requesting help on READTEXT statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway