September 6, 2014 at 11:21 am
Comments posted to this topic are about the item Synonyms 1
September 7, 2014 at 2:17 am
In the question:
CREATE SYNONYM Emp
but in the explanation:
SELECT * FROM emp2
From where this emp2 came?!
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
September 7, 2014 at 2:20 am
But anyway it`s good question although I am using table aliases in the code structure more than synonyms.
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
September 7, 2014 at 12:01 pm
Interesting question, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
September 7, 2014 at 12:54 pm
...but it works for Joe in HR (that's his default schema);-)
😎
September 7, 2014 at 6:43 pm
Hany Helmy (9/7/2014)
In the question:
CREATE SYNONYM Emp
but in the explanation:
SELECT * FROM emp2
From where this emp2 came?!
a typo. It's fixed
September 8, 2014 at 12:01 am
good question.
Vimal LohaniSQL DBA | MCP (70-461,70-462)==============================The greatest barrier to success is the fear of failure ** Success is a journey not a destination**Think before you print, SAVE TREES, Protect Mother Nature
September 8, 2014 at 12:01 am
Steve Jones - SSC Editor (9/7/2014)
Hany Helmy (9/7/2014)
In the question:
CREATE SYNONYM Emp
but in the explanation:
SELECT * FROM emp2
From where this emp2 came?!
a typo. It's fixed
Thx.
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
September 8, 2014 at 12:14 am
in sql server 2012 I am able to create the synoname also I am able to select the rows from the table.
so this means this is only true in the older version of the sql server.
Thanks
Vineet
September 8, 2014 at 12:14 am
Never gave it a second thought but figured deferred name resolution should be in play during synonym creation. Thanks for the question.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
September 8, 2014 at 1:06 am
Eirikur Eiriksson (9/7/2014)
...but it works for Joe in HR (that's his default schema);-)😎
That's true!
September 8, 2014 at 1:23 am
interesting question. Thanks for share
September 8, 2014 at 2:00 am
vineet_dubey1975 (9/8/2014)
in sql server 2012 I am able to create the synoname also I am able to select the rows from the table.so this means this is only true in the older version of the sql server.
Thanks
Vineet
USE LOCALWORK
GO
CREATE SCHEMA HumanResource
GO
CREATE TABLE HumanResource.Employee
(
EmpID INT IDENTITY,
EmpName Varchar(10)
);
GO
CREATE SYNONYM Emp FOR Employee;
SELECT * FROM EMP;
Just to confirm, if the above way you tested, then no, it still gives you the error below error in Sql 2012 dev edition (which currently I am using)
Msg 5313, Level 16, State 1, Line 1
Synonym 'emp' refers to an invalid object.
-//edit- Post your code, may be it is something different or I must have understood it wrong.
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
September 8, 2014 at 2:03 am
Thank you, SJ, interesting one.
(I had selected 2nd choice, but still I wrote the code to test my analysis... I succeed :-). To be honest, never tried this explicitly.)
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
September 8, 2014 at 3:26 am
This was removed by the editor as SPAM
Viewing 15 posts - 1 through 15 (of 36 total)
You must be logged in to reply to this topic. Login to reply