CREATE SYNONYM (Transact-SQL)
SQL Server 2005
建立新的同義字。
下列範例先建立 AdventureWorks 資料庫中之基底物件 Product 的同義字,再查詢這個同義字。
USE tempdb; GO -- Create a synonym for the Product table in AdventureWorks. CREATE SYNONYM MyProduct FOR AdventureWorks.Production.Product; GO -- Query the Product table by using the synonym. USE tempdb; GO SELECT ProductID, Name FROM MyProduct WHERE ProductID < 5; GO
以下為結果集:
----------------------- ProductID Name ----------- -------------------------- 1 Adjustable Race 2 Bearing Ball 3 BB Ball Bearing 4 Headset Ball Bearings (4 row(s) affected)
社群新增項目
新增
顯示:

