Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

output parameter of datatype TEXT in extended stored proc

Posted on 2002-07-24
5
Medium Priority
?
569 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 600 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

722 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