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.

Dynamic query in sqlanywhere

2 posts in General Discussion Last posting was on 2003-05-10 18:57:48.0Z
krishna Posted on 2003-05-10 18:31:48.0Z
From: krishna
Date: Sat, 10 May 2003 14:31:48 -0400
Newsgroups: ianywhere.public.general
Subject: Dynamic query in sqlanywhere
Message-ID: <F8C89047D19605140065C9D385256D22.0065C9E485256D22@webforums>
Lines: 14
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Path: forums-1-dub!forums-master.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub ianywhere.public.general:1008
Article PK: 3986

How can we execute a query inside a variable using ASA8.0?

create proc...
.
begin
.

select @mysql = "select * from mytable"

execute @mysql

end

This execute statement throws an error.


Breck Carter [TeamSybase] Posted on 2003-05-10 18:57:48.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Subject: Re: Dynamic query in sqlanywhere
Date: Sat, 10 May 2003 14:57:48 -0400
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <9kiqbvs82s9qh55nk6jid8qcstddj86ne5@4ax.com>
References: <F8C89047D19605140065C9D385256D22.0065C9E485256D22@webforums>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: bcarter.sentex.ca 64.7.134.118
Lines: 19
Path: forums-1-dub!forums-master.sybase.com!forums-1-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:1010
Article PK: 3344

Use 'single quotes' around character string literals.

The Transact SQL form of EXECUTE requires ( brackets ) around the
string expression. The Watcom SQL form EXECUTE IMMEDIATE does not. See
the Help.

You can't use EXECUTE on a statement that returns a result set in
Version 8. That feature is being added in Version 9, now in Beta
testing.

Breck

On Sat, 10 May 2003 14:31:48 -0400, krishna wrote:

>How can we execute a query inside a variable using ASA8.0?
>
>create proc...
>.
>begin
>.
>
>select @mysql = "select * from mytable"
>
>execute @mysql
>
>end
>
>This execute statement throws an error.

bcarter@risingroad.com
Mobile and Distributed Enterprise Database Applications
http://www.risingroad.com