How can I use variables in aqua data studio when connecting to a MySQL database? Here is a simple example:
set @var = 1
select @var
or
set @var = 1;
select @var;
This results in the following error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select @var' at line 2
set @var = 1
go
select @var
go
or this ...
set @var = 1
/
select @var
/
Ordinary query editors execute multiple SQL statements and knows how to parse them. Aqua studio with MySQL won't parse different sql statements on it's own. "Aqua Data Studio" using MySQL needs a 'delimiter' to issue > 1, sql statements. (ps declare @var doesn't work in query analyser either) Therefore, the original answer above, and the code below should work but, IN the Context of Aqua Studio connecting to MySQL db. try it literally as is:
GO
Set @myVar = 'Some VAlues'
/
Select @myVar
/
-- no declare
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.