Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Parameter in Sybase Stored Procedure

Status
Not open for further replies.

DilipKS

Programmer
Mar 8, 2004
30
CH
Hi
I am facing this problem. On compiling this stored procdure it says "TEXT or IMAGE datatypes are invalid for paramters or local variable"
I have OriginalMessage field which containts big XML and its not possible for me to change its datatype from text to some varchar ...any Hope I can still do it ?



CREATE PROCEDURE dbo.orgmsg_upd
@ExcpMsgID int,
@OriginalMessage text
AS
BEGIN
UPDATE SystemExceptions
SET OriginalMessage = @OriginalMessage
WHERE ExcpMsgID = @ExcpMsgID

END
 
You have wrong syntax.
Use round brackets in proc's header
Code:
CREATE PROCEDURE dbo.orgmsg_upd
( @ExcpMsgID int,
 @OriginalMessage text)
AS
BEGIN
  UPDATE   SystemExceptions
  SET      OriginalMessage = @OriginalMessage
  WHERE    ExcpMsgID = @ExcpMsgID         
END




 
The syntax isnt wrong. dont need bracets in header..


Restrictions on text and image Columns

text and image columns cannot be used:
As parameters to stored procedures or as values passed to these parameters
As local variables
In order by, compute, group by, and union clauses
In an index
In subqueries or joins
In a where clause, except with the keyword like
With the + concatenation operator
In the if update clause of a trigger
 
Hi Guys..
ya its limitation that we cant use text or image datatype as parameter in Sybase Stored procedure.
So I have dropped the idea of using stored procedure, and using directly "Update" Query SQL .
Thnks for ur replys.
Cheers
Dil
 
// mjuell
// The syntax isnt wrong. dont need bracets in header..

:) I mean ASA 6.0
I have no problem with text data type in params.
And my example works fine :)
 
whats ASA 6.0 ?
I tried ur example but it was not working . ??
 
Hm...

1. I use:
Adaptive Server Anywere 6.0.4.3763

2. I have a table named "TEST"
Code:
create table dba.test (id int default autoincrement not null, mes text default '' null) ;

3. I have a procededure named "DBA.TEST_PROC"
Code:
alter procedure DBA.TEST_PROC(@id integer,@mes TEXT)
as
begin
  update dba.test set  mes = @mes
  where
    id = @id
end

4. this line works perfect in ISQL:
Code:
exec dba.test_proc @id = 1 , @mes = 'test';



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top