|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hey!
I need to dynamically create an SQL statement within a MySQL 5.0.20 stored procedure. -- PSEUDO CODE create procedure DynSQLTest ( in sTable varchar(45) ) begin declare sSQL varchar(45); select Concat('select * from ',sTable,' where ...) into sSQL; EXECUTESQL(sSQL); end; Is there a possibility to construct the SQL in a varchar and then execute it? I spent some time googling but did not find anything. Thank you for any ! Fred |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Fred wrote:
> Is there a possibility to construct the SQL in a varchar and then > execute it? I spent some time googling but did not find anything. See here: http://dev.mysql.com/doc/refman/5.0/en/sqlps.html You can do this in stored procedures. See example in this article: http://dev.mysql.com/tech-resources/...toredproc.html Regards, Bill K. |
|
![]() |
| Outils de la discussion | |
|
|