Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - - 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!!!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...

select @mysql = "select * from mytable"

execute @mysql


This execute statement throws an error.

Breck Carter [TeamSybase] Posted on 2003-05-10 18:57:48.0Z
From: "Breck Carter [TeamSybase]" <>
Subject: Re: Dynamic query in sqlanywhere
Date: Sat, 10 May 2003 14:57:48 -0400
Organization: RisingRoad Professional Services
Message-ID: <>
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
Lines: 19
Path: forums-1-dub!!
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


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...
>select @mysql = "select * from mytable"
>execute @mysql
>This execute statement throws an error.
Mobile and Distributed Enterprise Database Applications