SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Synonym Limitation Questions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ddamico
Yak Posting Veteran

76 Posts

Posted - 09/20/2013 :  16:46:25  Show Profile  Reply with Quote
Good afternoon.

I have come across and interesting issue with regards to the user of synonyms and was curious if anyone has knowledge of this.

I essentially have a database that has logging functions and stored procedures. Within a second database I have created sysnonyms so that I do not need to reference the three part name in my procedure. Example follows.

ETL Database
LogMessage (stored procedure)
GetEvent (function) get event associated to the message to log

BASE Database
LogMessage = Synonym of Etl.dbo.LogMessage
GetEvent = Synonym of Etl.dbo.GetEvent

The issue I am having is that after a third level of sub-procedures the LogMessage store procedure fails with the following message.
Report.Post_Report: At line 259: Report.[Post_Report_Sub1] : At line 92: Report.[Get_Sub2] : At line 1: Database 'ETL' does not exist. Make sure that the name is entered correctly.

However, the GetEvent function will still work at the last level just not the LogMessage procedure.

Curious if anyone else has seen this behaivour. Thanks.

Bustaz Kool
Flowing Fount of Yak Knowledge

USA
1645 Posts

Posted - 09/23/2013 :  19:43:50  Show Profile  Reply with Quote
Are any of the intervening stored procedures being run in a different security context? This could be via an "EXECUTE AS" clause at create time or run time.

=================================================
The cure for anything is salt water -- sweat, tears, or the sea. -Isak Dinesen
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000