![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Two SQL Servers 1) "Test" Payroll DB Transaction Table pr_SubmitTransaction in Payroll DB ******************************************** 2) "Production" Payroll DB Transaction Table Pr_SubmitTransaction in Payroll DB Accounts DB Pr_VerifyAccounts (@AcctNumber) ******************************************** I want to use same pr_VeriftAccounts in both test and production Pr_SubmitTransaction stored procedure. The pr_SubmitTransaction in production works fine when I say Exec Payroll.dbo.pr_VerifyAccounts as it is on same server. (WORKS FINE) Exec [PRODUCTION].Payroll.dbo.pr_VerifyAccounts (DOES NOT WORK) Should I use sp_addlinkedServer ?? to do this ?. Please provide me some feedback. I know I can acheive this by front end, but I was do it in one stored procedure. |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Thanks for taking your time and effort replying to my question.Looks like its working, I can see the results in query analyzer but with one error Server: Msg 15028, Level 16, State 1, Procedure sp_addlinkedserver, The server 'PRODUCTION' already exists. (How can I get rid of this????) Is it because PRODUCTION is already registered in my enterprise manager or is it because PRODUCTION is not removed (sp_droplinkedserver or something like that) in stored procedure? |
#5
| |||
| |||
|
#6
| |||
| |||
|
#7
| |||
| |||
|
|
still issues...... In stored procedure itself I have two statements which says Exec sp_addlinkedServer 'PRODUCTION' Exec sp_addlinkedsrvlogin 'PRODUCTION','false',NULL,@LoginName,@Pwd Insert into [PRODUCTION]. --bla -bla Insert into <Localtable> --bla bla And in the end I have sp_removeserver [PRODUCTION] When I compile, it throws an error saying PRODUCTION is not in sysservers. But If I issue sp_addlinkedserver from outside, then it will let me compile. If you check I am doing that inside the code, so when ever it requires it, it is there. Presently I have to call three procedures from front end, One to Linkserver, one to do my regular insertion and all, and finally to drop server as a work around. Can this be put in one stored procedure ?? |
#8
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |