• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 611
  • Last Modified:

Is there an equivalent to synonym (oracle) in MS-SQL

Is there an equivalent to synonym (oracle) in MS-SQL ?
0
ymailhot
Asked:
ymailhot
1 Solution
 
Victor SpiridonovCommented:
What is the meaning of synonim in Oracle?
0
 
manand062397Commented:
SQL Server does not support synonyms but you can create views on table.  Views in SQLSERVER are updateable.  so it works like synonym.
0
 
ymailhotAuthor Commented:
In Oracle, if I create a table or a view with the user account TEST, then like in MS SQL Server, other user will have to access the table or view by specifying TEST.tablename.  

In Oracle, there is someting called public synonyms where if I create a public synonym tablename for TEST.tablename, everybody can refer to tablename and this will point to TEST.tablename.

This eliminates the need for hardcodeing TEST in the application, which would be a very bad practice.

I am looking for someting equivalent.  I understand how I could use views but that would involve creating one view for each table for each user.  I find the Oracle synonym solution much cleaner.  That is why I am surprised that MS SQL does not have any equivalent.
0
 
odessaCommented:
In fact if you create any user account only thing you need to do is to grant access on this user on particular table or view or something else see permissions and you do need to hardcode user that created object code only "tablename"


0
 
manand062397Commented:
You will be more surprise when you will find a lot of things which are really required but not available in SQL Server.  SQL Server 6.5 is 4-5 years behind  oracle.  We hope SQL Server fills this gap to an extend.    

Not only user name.table name you have to specify database too.....database.owner.table....if bother are in same database then no problem.

of course it is not a good practice to hard code user or database name but a lot features are not supported by sqlserver and this is one of them.....SQLSERVER SUCKS if you have oracle experience..
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now