Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Updating text fields

4 posts in General Discussion Last posting was on 2010-03-04 19:36:48.0Z
Vinay Posted on 2010-03-04 18:27:04.0Z
Sender: 841.4b8fec9e.1804289383@sybase.com
From: Vinay
Newsgroups: sybase.public.ase.general
Subject: Updating text fields
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4b8ffb78.994.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 4 Mar 2010 10:27:04 -0800
X-Trace: forums-1-dub 1267727224 10.22.241.41 (4 Mar 2010 10:27:04 -0800)
X-Original-Trace: 4 Mar 2010 10:27:04 -0800, 10.22.241.41
Lines: 32
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29022
Article PK: 78260

Hello,

I need to update two text datatype fields in Table B and
these
values are obtained from Table A. The code is inside a
stored proc. How can this be done as ASE does not allow text
fields to be passed as parameters to stored proc or to
declare them as local variables. Sybase Documentation on
this is not clear. See code below.


Select txt_A -------text datatype field( more than 40000
char)
txt_B -------text datatype field( more than 40000
char)

from Table A
where id = @as_id



UPDATE Table B
Set txt_A = 'the value of txt_A from table A'
txt B = 'the value of txt_B from table B'
WHERE amd_id = @as_amd_id


Any help in sending the code snippets will be greatly
helpful.

Regards,
Vinay


Vinay Posted on 2010-03-04 18:36:18.0Z
Sender: 841.4b8fec9e.1804289383@sybase.com
From: Vinay
Newsgroups: sybase.public.ase.general
Subject: Re: Updating text fields
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4b8ffd9f.9ba.1681692777@sybase.com>
References: <4b8ffb78.994.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 4 Mar 2010 10:36:18 -0800
X-Trace: forums-1-dub 1267727778 10.22.241.41 (4 Mar 2010 10:36:18 -0800)
X-Original-Trace: 4 Mar 2010 10:36:18 -0800, 10.22.241.41
Lines: 42
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29023
Article PK: 78261

Sorry there was a typo int the previous post. It should be

txt B = 'the value of txt_B from table A' (in the update
statement)

Thanks,
vinay

> Hello,
>
> I need to update two text datatype fields in Table B and
> these
> values are obtained from Table A. The code is inside a
> stored proc. How can this be done as ASE does not allow
> text fields to be passed as parameters to stored proc or
> to declare them as local variables. Sybase Documentation
> on this is not clear. See code below.
>
>
> Select txt_A -------text datatype field( more than 40000
> char)
> txt_B -------text datatype field( more than 40000
> char)
>
> from Table A
> where id = @as_id
>
>
>
> UPDATE Table B
> Set txt_A = 'the value of txt_A from table A'
> txt B = 'the value of txt_B from table B'
> WHERE amd_id = @as_amd_id
>
>
> Any help in sending the code snippets will be greatly
> helpful.
>
> Regards,
> Vinay


"Mark A. Parsons" <iron_horse Posted on 2010-03-04 18:47:56.0Z
From: "Mark A. Parsons" <iron_horse@no_spamola.compuserve.com>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
Subject: Re: Updating text fields
References: <4b8ffb78.994.1681692777@sybase.com>
In-Reply-To: <4b8ffb78.994.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 100301-0, 03/01/2010), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b90005c$1@forums-1-dub>
Date: 4 Mar 2010 10:47:56 -0800
X-Trace: forums-1-dub 1267728476 10.22.241.152 (4 Mar 2010 10:47:56 -0800)
X-Original-Trace: 4 Mar 2010 10:47:56 -0800, vip152.sybase.com
Lines: 45
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29024
Article PK: 78262

update table_B
set tb.txt_A = ta.txt_A
tb.txt_B = ta.txt_B
from table_A ta,
table_B tb
where ta.id = @as_id
and tb.amd_id = @as_amd_id

NOTE: I'm assuming table_A.id and table_B.amd_id are primary/unique keys for the tables in question, ie, only 1
match/record is found for both tables.

Vinay wrote:
> Hello,
>
> I need to update two text datatype fields in Table B and
> these
> values are obtained from Table A. The code is inside a
> stored proc. How can this be done as ASE does not allow text
> fields to be passed as parameters to stored proc or to
> declare them as local variables. Sybase Documentation on
> this is not clear. See code below.
>
>
> Select txt_A -------text datatype field( more than 40000
> char)
> txt_B -------text datatype field( more than 40000
> char)
>
> from Table A
> where id = @as_id
>
>
>
> UPDATE Table B
> Set txt_A = 'the value of txt_A from table A'
> txt B = 'the value of txt_B from table B'
> WHERE amd_id = @as_amd_id
>
>
> Any help in sending the code snippets will be greatly
> helpful.
>
> Regards,
> Vinay


Vinay Posted on 2010-03-04 19:36:48.0Z
Sender: a62.4b90060d.1804289383@sybase.com
From: Vinay
Newsgroups: sybase.public.ase.general
Subject: Re: Updating text fields
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4b900bd0.abe.1681692777@sybase.com>
References: <4b90005c$1@forums-1-dub>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 4 Mar 2010 11:36:48 -0800
X-Trace: forums-1-dub 1267731408 10.22.241.41 (4 Mar 2010 11:36:48 -0800)
X-Original-Trace: 4 Mar 2010 11:36:48 -0800, 10.22.241.41
Lines: 53
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29025
Article PK: 78264

Mark,

That works. Much simpler than I thought. Didn't think of
this join as the tables don't share a common key.

Thanks,
Vinay

> update table_B
> set tb.txt_A = ta.txt_A
> tb.txt_B = ta.txt_B
> from table_A ta,
> table_B tb
> where ta.id = @as_id
> and tb.amd_id = @as_amd_id
>
> NOTE: I'm assuming table_A.id and table_B.amd_id are
> primary/unique keys for the tables in question, ie, only 1
> match/record is found for both tables.
>
>
> Vinay wrote:
> > Hello,
> >
> > I need to update two text datatype fields in Table B and
> > these
> > values are obtained from Table A. The code is inside a
> > stored proc. How can this be done as ASE does not allow
> > text fields to be passed as parameters to stored proc or
> > to declare them as local variables. Sybase Documentation
> > on this is not clear. See code below.
> >
> >
> > Select txt_A -------text datatype field( more than 40000
> > char)
> > txt_B -------text datatype field( more than 40000
> > char)
> >
> > from Table A
> > where id = @as_id
> >
> >
> >
> > UPDATE Table B
> > Set txt_A = 'the value of txt_A from table A'
> > txt B = 'the value of txt_B from table B'
> > WHERE amd_id = @as_amd_id
> >
> >
> > Any help in sending the code snippets will be greatly
> > helpful.
> >
> > Regards,
> > Vinay