Wild card in SelectSQL

I am getting a database (syntax) error on the following statements:

sql = "SELECT HashValue FROM ?"
rs = theDB.SelectSQL (sql, tablename)

The error message is near "?": syntax error

Is using a wildcard for the tablename legal?

Data: Windows 10, Xojo 2021r2, Sqlite

You could just do:

sql = "select HashValue from " + tablename
rs = theDB.SelectSQL (sql)

How is tablename declared? And does the sql match the schema?

No, it’s not legal there. You’ll need to do something like SELECT * FROM “”“ + TableName.ReplaceAll(“”””, “”””””) + “””;” instead.

That’s what I thought. :slightly_frowning_face: I was hoping to avoid string concatenation but that’ll have to be the route I’ll take.

Tablename is a string and, yes, the sql matches the schema.

I use wildcards frequently in various WHERE clauses but having it in the FROM clause would make things a bit easier for me. Ah, well…

I’m not saying you can’t do it - haven’t tested that.