Solved

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

Posted on 1998-05-12
5
588 Views
Last Modified: 2012-06-21
Is there an equivalent to synonym (oracle) in MS-SQL ?
0
Comment
Question by:ymailhot
5 Comments
 
LVL 7

Expert Comment

by:spiridonov
ID: 1089666
What is the meaning of synonim in Oracle?
0
 
LVL 2

Expert Comment

by:manand062397
ID: 1089667
SQL Server does not support synonyms but you can create views on table.  Views in SQLSERVER are updateable.  so it works like synonym.
0
 

Author Comment

by:ymailhot
ID: 1089668
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
 
LVL 2

Accepted Solution

by:
odessa earned 50 total points
ID: 1089669
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
 
LVL 2

Expert Comment

by:manand062397
ID: 1089670
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now