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