Click here to Skip to main content
14,734,084 members
Home » Discussions » Database
   

Database

 
GeneralRe: Data on one server, structure on another Pin
Corporal Agarn22-Jul-11 5:27
professionalCorporal Agarn22-Jul-11 5:27 
GeneralRe: Data on one server, structure on another Pin
_Zorro_22-Jul-11 5:50
professional_Zorro_22-Jul-11 5:50 
GeneralRe: Data on one server, structure on another Pin
Corporal Agarn22-Jul-11 6:03
professionalCorporal Agarn22-Jul-11 6:03 
GeneralRe: Data on one server, structure on another Pin
_Zorro_22-Jul-11 6:17
professional_Zorro_22-Jul-11 6:17 
AnswerRe: Data on one server, structure on another Pin
smcnulty200022-Jul-11 21:58
Membersmcnulty200022-Jul-11 21:58 
GeneralRe: Data on one server, structure on another Pin
_Zorro_25-Jul-11 3:37
professional_Zorro_25-Jul-11 3:37 
GeneralRe: Data on one server, structure on another Pin
smcnulty200025-Jul-11 8:33
Membersmcnulty200025-Jul-11 8:33 
GeneralRe: Data on one server, structure on another Pin
_Zorro_25-Jul-11 23:22
professional_Zorro_25-Jul-11 23:22 
Here's why:

CREATE SYNONYM [ schema_name_1. ] synonym_name FOR <object><br />
<br />
<object> :: =<br />
{<br />
    [ server_name.[ database_name ] . [ schema_name_2 ].| database_name . [ schema_name_2 ].| schema_name_2. ] object_name<br />
}<br />


USE tempdb;<br />
GO<br />
-- Create a synonym for the Product table in AdventureWorks2008R2.<br />
CREATE SYNONYM MyProduct<br />
FOR AdventureWorks2008R2.Production.Product;<br />
GO<br />
<br />
-- Query the Product table by using the synonym.<br />
USE tempdb;<br />
GO<br />
SELECT ProductID, Name <br />
FROM MyProduct<br />
WHERE ProductID < 5;<br />
GO<br />


Maybe I'm not seeing it, but how would you manage to use the same procedure and call different databases depending on who called the procedure?

Let's say we have db1 and db2 and we're doing:

SELECT A, B, C FROM dbo.Table

What I need is to call the data from db1 if the application made the call, but go read the data on db2 if the call was made by the build server (the unit/integration tests).
GeneralRe: Data on one server, structure on another Pin
smcnulty200025-Jul-11 9:16
Membersmcnulty200025-Jul-11 9:16 
GeneralRe: Data on one server, structure on another Pin
_Zorro_25-Jul-11 23:24
professional_Zorro_25-Jul-11 23:24 
AnswerRe: Data on one server, structure on another Pin
Mycroft Holmes22-Jul-11 22:24
professionalMycroft Holmes22-Jul-11 22:24 
GeneralRe: Data on one server, structure on another Pin
smcnulty200022-Jul-11 22:32
Membersmcnulty200022-Jul-11 22:32 
GeneralRe: Data on one server, structure on another Pin
Mycroft Holmes23-Jul-11 1:03
professionalMycroft Holmes23-Jul-11 1:03 
GeneralRe: Data on one server, structure on another Pin
David Skelly24-Jul-11 23:36
MemberDavid Skelly24-Jul-11 23:36 
GeneralRe: Data on one server, structure on another Pin
_Zorro_25-Jul-11 3:45
professional_Zorro_25-Jul-11 3:45 
GeneralRe: Data on one server, structure on another Pin
Mycroft Holmes25-Jul-11 13:13
professionalMycroft Holmes25-Jul-11 13:13 
GeneralRe: Data on one server, structure on another Pin
_Zorro_25-Jul-11 23:15
professional_Zorro_25-Jul-11 23:15 
GeneralRe: Data on one server, structure on another Pin
Mycroft Holmes25-Jul-11 23:43
professionalMycroft Holmes25-Jul-11 23:43 
GeneralRe: Data on one server, structure on another Pin
_Zorro_26-Jul-11 2:53
professional_Zorro_26-Jul-11 2:53 
Questionset password on database in sql server 2005 Pin
SajjadZare21-Jul-11 23:11
MemberSajjadZare21-Jul-11 23:11 
AnswerRe: set password on database in sql server 2005 Pin
Blue_Boy21-Jul-11 23:24
MemberBlue_Boy21-Jul-11 23:24 
JokeRe: set password on database in sql server 2005 Pin
lw@zi 21-Jul-11 23:27
professional lw@zi 21-Jul-11 23:27 
JokeRe: set password on database in sql server 2005 Pin
Blue_Boy21-Jul-11 23:28
MemberBlue_Boy21-Jul-11 23:28 
GeneralRe: set password on database in sql server 2005 Pin
SajjadZare22-Jul-11 1:24
MemberSajjadZare22-Jul-11 1:24 
GeneralRe: set password on database in sql server 2005 Pin
Blue_Boy22-Jul-11 3:56
MemberBlue_Boy22-Jul-11 3:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.