Solved

output parameter of datatype TEXT in extended stored proc

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

919 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

17 Experts available now in Live!

Get 1:1 Help Now