Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Gerrit Broekhuis
  Where is Gerrit Broekhuis?
 Holten
 Netherlands
 Gerrit Broekhuis
Subject: SQLEXEC tables from MySQL database
Thread ID: 460738 Message ID: 460738 # Views: 93 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Tuesday, September 25, 2018 1:01:51 PM         
   



Hi,

I'm using SQLEXEC to get a list of all tables in a MySQL database:

* setup ODBCC connection here
LOCAL lcCursor, lcTable
lcCursor = "TABLES_CURSOR"
lcTable = "abcdef"

TEXT TO m.cSQL NOSHOW
SELECT table_name FROM information_schema.tables WHERE table_schema = ( lcTable )
ENDTEXT

SQLEXEC(gnConnHandle, m.cSQL, m.lcCursor) 


This will give an error: Unknown column 'lcTable' in 'where clause'

If I replace ( lcTable ) with "abcdef" the query runs fine. I tried some variations, like ("&lcTable"), &lcTable, "&lcTable", lcTable and (&lcTable), but without any luck.
What is the right syntax to get this query working with a variable for the table_scheme?

Regards, Gerrit

Today is only yesterday's tommorrow - Uriah Heep

ENTIRE THREAD

SQLEXEC tables from MySQL database Posted by Gerrit Broekhuis @ 9/25/2018 1:01:51 PM
RE: SQLEXEC tables from MySQL database Posted by Tore Bleken @ 9/25/2018 1:32:56 PM
RE: SQLEXEC tables from MySQL database Posted by Gerrit Broekhuis @ 9/25/2018 1:44:21 PM
RE: SQLEXEC tables from MySQL database Posted by Tore Bleken @ 9/25/2018 1:49:45 PM
RE: SQLEXEC tables from MySQL database Posted by Koen Piller @ 9/25/2018 1:34:39 PM
RE: SQLEXEC tables from MySQL database Posted by Anil Sharma @ 10/1/2018 3:41:28 PM
RE: SQLEXEC tables from MySQL database Posted by Jun Tangunan @ 10/2/2018 12:15:26 AM
RE: SQLEXEC tables from MySQL database Posted by Anil Sharma @ 10/6/2018 9:35:31 AM
RE: SQLEXEC tables from MySQL database Posted by Jun Tangunan @ 10/6/2018 10:36:28 AM
RE: SQLEXEC tables from MySQL database Posted by Tamar Granor @ 10/2/2018 10:25:07 PM
RE: SQLEXEC tables from MySQL database Posted by Gerrit Broekhuis @ 10/4/2018 10:56:49 AM
RE: SQLEXEC tables from MySQL database Posted by Noel Cris @ 2/11/2019 5:47:29 AM