I want to create Synonym for a table , so all the other users in this database use this Synonym instead of writing data开发者_高级运维basename.schema.table , but when I write :
CREATE SYNONYM [ACCT_STMT] FOR [AccountStatementPRD].[dbo].[ACCT_STMT]
GO
it generates an error msg :
There is already an object named 'ACCT_STMT' in the database. Msg 4606,
in oracle , I can create Synonym with the same table name !
if all you want is to use it by name only, and you already executing the statment in the correct DB, you don't have to use databasename.schema.tablename, just use tablename
for example, instead of
SELECT * FROM [AccountStatementPRD].[dbo].[ACCT_STMT]
you can just do
SELECT * FROM [ACCT_STMT]
as far as having the same name for synonym, that will not work in the same DB
精彩评论