Solved

output parameter of datatype TEXT in extended stored proc

Posted on 2002-07-24
5
565 Views
Last Modified: 2007-12-19
Hello All,

I was trying to find a way how I could return a string of more than 8000 characters from extended stored proc.

BOL says that Open Data Services supports text data type but it doesn’t say anything specific about how it should be programmed.

I’d appreciate any information regarding the subject and I'd also give 400 pts to someone who could show me the way how to do it.

So far this is what I’ve come up with:


--- foo.sql

CREATE PRCO foo
      @param text
AS
BEGIN
  DECLARE @res int, @hdoc int

  EXEC  @res = master.dbo.xp_proc @param OUTPUT
      . . .  
  EXEC sp_xml_preparedocument @hdoc OUTPUT, @param
      . . .  
END

--- xp_proc.c
      ...
      result = srv_paramsetoutput (srvproc, 1, (BYTE*)spText, len, FALSE);
      ...
--- from Query Analyzer exec the following to see the error message below

EXEC foo ‘’

Server: Msg 206, Level 16, State 2, Procedure xp_proc, Line 6
Operand type clash: int is incompatible with text
 
I could not explain the error message because in this case it doesn’t really fit.

Note that the code is working just fine if stored proc is declared as

CREATE PRCO foo
      @param varchar(8000)
AS

Thanks,
devatotn
0
Comment
Question by:devatotn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
miron earned 300 total points
ID: 7176230
I believe that you need to call extended stored procedure directpy from VB / C /C++ code and pass it array up to 64KB in size.

Cheers
0
 
LVL 2

Author Comment

by:devatotn
ID: 7647807
not exactly the answer I was looking for as in this case the need was to get results in T-SQL sproc and not anything else.

Back then I tried many different approaches and used the one where I had four varchar(8000) output parameters which I concatenated later on.

0
 
LVL 9

Expert Comment

by:miron
ID: 7653519
"not [...] the answer" should not be graded, please, take a look at the EE guidelines.

--Cheers
0
 
LVL 2

Author Comment

by:devatotn
ID: 7656689
This is strange.. I'm sure I graded the answer with C which as I can see is reflected in my profile.
0
 
LVL 9

Expert Comment

by:miron
ID: 7657873
what is so strange,

a mere ability to push a button on the screen and save a grade "C" in the profile does not allow a user to void the rules of using the site.

--Cheers
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question