經過一番研究,我編輯了我的答案。
關於EXECUTE (string-expression)
聲明,是的,您必須爲字符串表達式使用單引號而不是雙引號。 This頁提到:
It lets you execute dynamically prepared statements, such as statements that are constructed using the parameters passed in to a procedure. Literal strings in the statement must be enclosed in single quotes, and the statement must be on a single line.
這將消除列沒有發現錯誤,但過程將返回此其他錯誤:試圖執行僅此語句時
Result set not permitted in '<batch statement>'
同樣的錯誤返回:
execute ('select * from sysusers')
With probable cause:
You attempted to execute a SELECT statement in a context where a result set is not permitted.
看到我最近的解決方案的答案。
和關於架構,這裏是如何引用對象:
It is always good practice to refer to database objects by a schema name and the object name, separated by a period (.). For a complete example, to SELECT records from the Employee table in the HumanResources schema of the current database would look like:
SELECT * FROM HumanResources.Employee
To reference an object located in a remote database, the fully qualified object name includes the server name and the database name. For example, to SELECT records from the Employee table in the HumanResources schema in the AdventureWorks database on MyServer would look like:
SELECT * FROM MyServer.AdventureWorks.HumanResources.Employee
我測試了在SQL Anywhere中12和它的工作原理是相同的。雖然我不熟悉的模式,就是我建議你下面是實際使用的模式,會的dbowner是架構名稱:
1)select * from dbname.dbowner.tablename
2)select * from dbowner.tablename
3)select * from dbname..tablename
(假設表中dbo
模式存在)
底線....在SELECT語句cds.ppl
必須是一個名爲在cds
模式中創建ppl
表。
或者,如果cds
是你的數據庫名稱和dbo
模式中創建ppl
你的表名,你缺少一個點:
select * from cds..ppl
無論你寫在from必須是數據庫中的對象之後,表或視圖以及表/視圖名稱之間不能有一個點。什麼是cds.ppl? – 2012-04-19 18:14:18