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!

Error when trying to copy columns using stored procedure

Status
Not open for further replies.

limester

Technical User
Dec 29, 2004
69
CA
Hi,

I am using Sybase v11.x. I am trying to copy from one
column to another column in a stored procedure as follows:

UPDATE tbl1
SET column1 = (select column2 from tbl2 where @variable =
variable)
WHERE @parameter = parameter

Everything is declared approriately.

The problem seems to be the datatypes TEXT for both column1
and column2, the error I get is:
"The ONCE AGGREGATE operation cannot take a TEXT datatype as
an argument."

I cannot covert these to other data types and they will
always be longer than 255 characters.

Does anyone know a way I can get around this? (apart from
using version 12.x where I can convert/cast and > 255
characters)

Thanks!
 
Seems the fact of encapsulating the subquery in brackets I am creating a local variable which is a TEXT datatype and not allowed in this case.

Instead I:

UPDATE tbl1
SET tbl1.col1 = tbl2.col1 from tbl2
WHERE @param = tbl1.col2 and @param = tbl2.col2

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top