Click here to Skip to main content
15,909,440 members
Home / Discussions / Database
   

Database

 
GeneralRe: Pagination Pin
Wendelius14-Aug-08 5:53
mentorWendelius14-Aug-08 5:53 
QuestionRe: Pagination Pin
windhopper14-Aug-08 20:21
windhopper14-Aug-08 20:21 
AnswerRe: Pagination Pin
Wendelius15-Aug-08 4:08
mentorWendelius15-Aug-08 4:08 
GeneralRe: Pagination Pin
windhopper15-Aug-08 4:13
windhopper15-Aug-08 4:13 
GeneralRe: Pagination Pin
Wendelius15-Aug-08 4:30
mentorWendelius15-Aug-08 4:30 
QuestionBulk Insert in Oracle Pin
Member 209771914-Aug-08 1:35
Member 209771914-Aug-08 1:35 
AnswerRe: Bulk Insert in Oracle Pin
Wendelius14-Aug-08 5:40
mentorWendelius14-Aug-08 5:40 
QuestionSQL 2005 Cross-DB Coding Compatibility [modified] Pin
MatthysDT13-Aug-08 23:45
MatthysDT13-Aug-08 23:45 
O.k, I'm re-wording my post.
How can I dynamically change the target database of some SQL code like a stored procedure or a function?
In other words...
I have this:
Execute MyDataBase..procAddHistoryEvent(@Blah,etc)
Update MyDataBase..tblWoof set WoofColumn1 = 'bark952' where WoofColumn2 = @Blah
but my solution requires something like this:
Execute @SelectedDB..procAddHistoryEvent(@Blah,etc)
Update @SelectedDB..tblWoof set WoofColumn1 = 'bark952' where WoofColumn2 = @Blah

My old post_________________________________________________________________________________________

Scenario...
Our system runs multiple DB's on a single SQL2005 Server. The DB naming is usually is not a problem since our software can be configured to which DB it should connect for which data. I.e Client1's application could connect to the DB Client1Data.
So when we restore data for debugging and don't want to overwrite an existing DB we simply restore it as (e.g.) Client1DataTest.
But...
Our software uses multiple DB's, so Client1's software also uses DB's for (e.g.) Client1Messages, Client1Mail etc. So for debugging we would load DB's for Client1DataTest, Client1MessagesTest, Client1MailTest etc.
So my question...
All our DB's run stored procedures (SP's) and in quite a few cases one DB will execute a SP on another DB with the following syntax:
Execute Client1Data..procAddHistoryEvent(@Blah,etc)
or simply select, update, delete and insert data on another DB e.g.:
Update Client1Messages..tblWoof set WoofColumn1 = 'bark952' where WoofColumn2 = @Blah
It's clear how the above is kinda hardcoded.
So when we run our system on a test DB say, Client1DataTest, it still wrongly accesses data from and executes code on Client1Messages instead of Client1MessagesTest.
Is there a better way of doing this OTHER than compiling and executing SQL strings all over the place?
Kind Regards


modified on Thursday, August 14, 2008 9:03 AM

AnswerRe: SQL 2005 Cross-DB Coding Compatibility Pin
Wendelius14-Aug-08 5:44
mentorWendelius14-Aug-08 5:44 
AnswerRe: SQL 2005 Cross-DB Coding Compatibility Pin
Mycroft Holmes14-Aug-08 15:45
professionalMycroft Holmes14-Aug-08 15:45 
Questionget row index Pin
nelsonpaixao13-Aug-08 13:16
nelsonpaixao13-Aug-08 13:16 
AnswerRe: get row index Pin
Mycroft Holmes13-Aug-08 13:48
professionalMycroft Holmes13-Aug-08 13:48 
AnswerRe: get row index Pin
PIEBALDconsult13-Aug-08 14:08
mvePIEBALDconsult13-Aug-08 14:08 
AnswerRe: get row index Pin
RyanEK13-Aug-08 17:20
RyanEK13-Aug-08 17:20 
AnswerRe: get row index Pin
Blue_Boy13-Aug-08 22:08
Blue_Boy13-Aug-08 22:08 
AnswerRe: get row index Pin
Tripathi Swati18-Aug-08 22:42
Tripathi Swati18-Aug-08 22:42 
Questionfast search with SQL Server 2000 on varchar column Pin
Rajkamal_dfine13-Aug-08 9:17
Rajkamal_dfine13-Aug-08 9:17 
AnswerRe: fast search with SQL Server 2000 on varchar column Pin
Wendelius13-Aug-08 9:41
mentorWendelius13-Aug-08 9:41 
QuestionSQL Hosting advice Pin
AlexeiXX313-Aug-08 8:43
AlexeiXX313-Aug-08 8:43 
AnswerRe: SQL Hosting advice Pin
leoinfo13-Aug-08 9:45
leoinfo13-Aug-08 9:45 
GeneralRe: SQL Hosting advice Pin
AlexeiXX313-Aug-08 9:51
AlexeiXX313-Aug-08 9:51 
Questiona qucik question Pin
alexyxj13-Aug-08 7:58
alexyxj13-Aug-08 7:58 
AnswerRe: a qucik question Pin
PIEBALDconsult13-Aug-08 8:03
mvePIEBALDconsult13-Aug-08 8:03 
GeneralRe: a qucik question Pin
Wendelius13-Aug-08 8:04
mentorWendelius13-Aug-08 8:04 
AnswerRe: a qucik question Pin
Tim Carmichael13-Aug-08 8:06
Tim Carmichael13-Aug-08 8:06 

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.