SYNONYM is a great feature of SQL Server.It can be used in our day to day T-SQL programming.
But where and how it can be used?
I am trying to fetch records from Employee table of BGDB database inside PERSONAL database.
So syntax will be something like this.
SELECT * FROM BGDB.dbo.Employee
Here we can use SYNONYM to make it short and compact.
CREATE SYNONYM BGDBEmp
FOR BGDB.dbo.Employee
Now we can write SELECT statement as below
SELECT * FROM BGDBEmp
That’s It.
Enjoy Learning.
No comments:
Post a Comment