Solved

output parameter of datatype TEXT in extended stored proc

Posted on 2002-07-24
5
560 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
  • 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now