Solved

output parameter of datatype TEXT in extended stored proc

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

772 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