June 16, 2006 at 10:04 am
Can I make a Synonym for an entire Database ?
For example something like....
create
SYNONYM syndDB FOR [YourServerName].YourDatabaseName]
and then
select * from [syndDB].sys.sysobjects
TIA
Mathew J Kulangara
sqladventures.blogspot.com
June 16, 2006 at 1:46 pm
Synonyms are only for the schema objects.
June 18, 2006 at 9:23 pm
The attempt to create a synonym for a DB appears to execute successfully, but then to reference that in a select fails. Synonym works well with tables where the fully qualified name is onerous but you can't reference the synonym for a DB even though it appears to get created.
Create
synonym ab for doomeddb.dbo.accbalance
select
* from ab
1 2006 1000.00
1 2007 2000.00
1 2008 3000.00
2 2006 4000.00
2 2007 5000.00
3 2008 6000.00
create
synonym dm for doomeddb
Command(s) completed successfully
select * from dm.dbo.accbalance
Msg 208, Level 16, State 1, Line 1
Invalid object name 'dm.dbo.accbalance'.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply