0
我想在sql服务器查询where子句中使用sqsh变量,但无法使其工作。以下是对我所面临问题的简单模拟。有人可以帮我解决这个在sqsh脚本中使用变量不工作,而在sql服务器查询
可正常工作
select * from information_schema.tables where table_name = 'PHONES';
但下面不会工作
\set tableName=PHONES;
select * from information_schema.tables where table_name = $tableName;
Error Message:: Invalid column name 'PHONES'
select * from information_schema.tables where table_name = '$tableName';
No rows are returned as it searches for a table $tableName
select * from information_schema.tables where table_name = "$tableName";
Error Message:: Invalid column name 'PHONES'.
像冠军一样工作。 – kishore