Congratulations to all the winners of April 2013, they have won INR 3400 cash and INR 20147 worth prizes !
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 8705 |  Welcome, Guest!   Register  Login
 Home > Forums > Sql Server > what is synonym in sql ,what is it purpose ...
Yugandhar

what is synonym in sql ,what is it purpose

Replies: 9 | Posted by: Yugandhar on 8/22/2012 | Category: Sql Server Forums | Views: 642 | Status: [Member] | Points: 10  


what is synonym in sql ,what is it purpose
what type of commands we can use


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Nadh123
Nadh123  
Posted on: 8/22/2012 9:04:02 AM
Level: Starter | Status: [Member] | Points: 25

synonym is a duplicate name of table

server1: emp database name and employee table name

server2 acees this emp table is server1.emp.employee this access the table
select * from server1.emp.employee this access the table
wecan simple create synonym
CREATE SYNONYM S2.EMP FOR SERVER1.EMP.EMPLOYEE
simple select * from S2.EMP EXECUTE THE QUERY

Mahendra
91-9908699686

Yugandhar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Yugandhar
Yugandhar  
Posted on: 8/22/2012 9:22:21 AM
Level: Starter | Status: [Member] | Points: 25

thanks nadh123 for ur ans.
can u explain bit more
like
1.what commands we can use on that and if we change the data in synonym ,then what what is effect on the original table
2.it purpose only to simply the name

Yugandhar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Nadh123
Nadh123  
Posted on: 8/22/2012 9:32:44 AM
Level: Starter | Status: [Member] | Points: 25

original table effected the data

Mahendra
91-9908699686

Yugandhar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Yugandhar
Yugandhar  
Posted on: 8/22/2012 9:49:17 AM
Level: Starter | Status: [Member] | Points: 25

and 2.purpose

Yugandhar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Muhsinathk
Muhsinathk  
Posted on: 9/14/2012 9:08:51 AM
Level: Bronze | Status: [Member] | Points: 50

Resolved

Synonyms

1)A synonyms is a single-part name which can replace multi part name in SQL Statement. Use of synonyms cuts down typing long multi part server name and can replace it with one synonyms. It also provides an abstractions layer which will protect SQL statement using synonyms from changes in underlying objects
2)A synonym is an alternative name for objects such as tables, views, sequences, stored procedures, and other database objects.

Create Synonyms :
USE AdventureWorks;
GO
CREATE SYNONYM MyLocation
FOR AdventureWorks.Production.Location;
GO

Use Synonyms :
USE AdventureWorks;
GO
SELECT TOP 5 *
FROM MyLocation;
GO

Drop Synonyms :
USE AdventureWorks;
GO
DROP SYNONYM MyLocation;
GO

Yugandhar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Muhsinathk
Muhsinathk  
Posted on: 9/14/2012 9:12:51 AM
Level: Bronze | Status: [Member] | Points: 25

Please mark as answer if it helpful to you..That helps others who search the same..

Yugandhar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Hariinakoti
Hariinakoti  
Posted on: 9/17/2012 5:16:33 AM
Level: Starter | Status: [Member] | Points: 25

Good Work Muhsinathk

Thanks & Regards
Hari

Yugandhar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Muhsinathk
Muhsinathk  
Posted on: 9/17/2012 5:58:27 AM
Level: Bronze | Status: [Member] | Points: 25

Thanks..

Yugandhar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Vikash
Vikash  
Posted on: 9/17/2012 6:39:48 AM
Level: Starter | Status: [Member] | Points: 25

you can try the following links....
http://www.dbforums.com/microsoft-sql-server/1667196-how-create-synonym-view-entire-database-tables-view.html

Regards,
Vikash Pathak

Yugandhar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/19/2013 10:01:09 AM