Execute Remote Stored Procedure From The Receiver's Queue
Sep 27, 2006
How can my receiver's queue procedure execute a procedure on another server?
Everytime it gets to that remote procedure statement, I get DISCONNECTED_INBOUND status.
The procedure I want to call is on SQL 2000.
I am doing my first SSB application where two different servers send messages to each other. The logic was all previously tested on a single server between two databases and it worked OK.
The problem I am having is that when the message is received at the target server (I see this in profiler), the stored procedure associated with the queue does not fire.
I see an acknowledgment fire back to the initiator, but it is like the target server does nothing with the initial message.
Any ideas on how I can further troubleshoot this? FWIW, I used the setup tool provided by RemusResanu to set up the routes and service bindings.
I've added the linked server options with the appropriate login credentials (Be made using this security context) to access the remote server. The account used is db_owner on both the desired db and the master db.
When I query [serverinstance].database.dbo.customers I get the results I desire but when I try to execute a stored procedure on that database, exec [serverinstance].database.dbo.procCustomers, the following error occurs:
Msg 18483, Level 14, State 1, Line 1 Could not connect to server 'serverinstance' because 'logn' is not defined as a remote login at the server. Verify that you have specified the correct login name. .
I have written a VB component to execute a SSIS package stored in SQL server.
I am using the Microsoft.sqlserver.dts.dtsclient, dtsconnection/dtscommand
and executereader and everything works perfect on the local machine. This is descibed in a msdn site .
But my customer have a remote SQL server and want no extra BI clients/SQL server clients etc on the client machine, only an ordinary windows client and network connection to the SQL server.
My question is: Can you still use dtsclient or do you have to do in some other way?
I am trying to debug stored procedure using visual studio. I right click on connection and checked 'Allow SQL/CLR debugging' .. the store procedure is not local and is on sql server.
Whenever I tried to right click stored procedure and select step into store procedure> i get following error
"User 'Unknown user' could not execute stored procedure 'master.dbo.sp_enable_sql_debug' on SQL server XXXXX. Click Help for more information"
I am not sure what needs to be done on sql server side
We tried to search for sp_enable_sql_debug but I could not find this stored procedure under master.
Some web page I came accross says that "I must have an administratorial rights to debug" but I am not sure what does that mean?
I am calling a stored procedure (say X) and from that stored procedure (i mean X) i want to call another stored procedure (say Y)asynchoronoulsy. Once stored procedure X is completed then i want to return execution to main program. In background, Stored procedure Y will contiue his work. Please let me know how to do that using SQL Server 2000 and ASP.NET 2.
Hello, I am hoping there is a solution within SQL that work for this instead of making round trips from the front end. I have a stored procedure that is called from the front-end(USP_DistinctBalancePoolByCompanyCurrency) that accepts two parameters and returns one column of data possibly several rows. I have a second stored procedure(USP_BalanceDateByAccountPool) that accepts the previous stored procedures return values. What I would like to do is call the first stored procedure from the front end and return the results from the second stored procedure. Since it's likely I will have more than row of data, can I loop the second passing each value returned from the first? The Stored Procs are: CREATE PROCEDURE USP_DistinctBalancePoolByCompanyCurrency @CID int, @CY char(3) AS SELECT Distinct S.BalancePoolName FROM SiteRef S INNER JOIN Account A ON A.PoolId=S.ID Inner JOIN AccountBalance AB ON A.Id = AB.AccountId Inner JOIN AccountPool AP On AP.Id=A.PoolId Where A.CompanyId=@CID And AB.Currency=@CY
CREATE PROCEDURE USP_BalanceDateByAccountPool @PoolName varchar(50) AS Declare @DT datetime Select @DT= (Select MAX(AccountBalance.DateX) From Company Company INNER JOIN Account Account ON Company.Id = Account.CompanyId INNER JOIN SiteRef SiteRef ON Account.PoolId = SiteRef.ID Inner JOIN AccountBalance AccountBalance ON Account.Id = AccountBalance.AccountId WHERE SiteRef.BalancePoolName = @PoolName) SELECT SiteRef.BalancePoolName, AccountBalance.DateX, AccountBalance.Balance FROM Company Company INNER JOIN Account Account ON Company.Id = Account.CompanyId INNER JOIN SiteRef SiteRef ON Account.PoolId = SiteRef.ID Inner JOIN AccountBalance AccountBalance ON Account.Id = AccountBalance.AccountId WHERE SiteRef.BalancePoolName = @PoolName And AccountBalance.DateX = @DT Order By AccountBalance.DateX DESC
Any assistance would be greatly appreciated. Thank you, Dave
I have a strange error that occurs if I run ALTER QUEUE with status = OFF on my receiving queue...
Purpose of the test was to check that when the queue get disabled all my event notification set up works fine ..
I found out that the Event Notification will not be thrown if I call ALTER QUEUE with status = OFF on a queue that has not messages inside but If I run anyway ALTER QUEUE with status = OFF I found out that the receive activation Stored Procedure is called and because the code is wrapped around a
BEGIN TRY
...
END TRY
BEGIN CATCH
RAISEERROR (.........) WITH LOG
END CATCH
the SP goes in the catch block and actually I see my Application event log full of entries that contains:
The conversation handle is missing. Specify a conversation handle.'
First at all:
why the activated stored procedure is called if I execute:ALTER QUEUE with status = OFF ?
Hi! We are using Delphi application to call stored procedure remotely. With SQL Server 6.5 everything worked perfectly. After upgrate to SQL Server 7.0 the following error message appear: Can't find stored procedure. When I open SQL Ent.Manager and run stored procedure locally, there is no problem exist. Thank you in advance. Anny
I need to execute the stored procedure/sql statement from different sql server.I have described below, what i have done to do this...if it is not the correct process, please let me know the correct one.....thanks
I have added the remote server on local server by using the following....
How can I use in stored procedure the faction ‘’in’’ to select values, using execute and the values must not be specified before in the stored procedure
How do you execute a stored procedure in MS SQL Server?I can design and execute them from MS Access dev front end, but cannot seemto find how to run them in the Enterprise Manager.TIA.~ Duane Phillips.
I have setup a user which has execute rights on a stored procedure. The sp is owned by dbo. The user can execute the stored procedure, but it fails, because the stored procedure calls other tables and procedures that the user does not have rights to. Is there a way to allow those procedures to execute without allowing access to everything else for the user I setup? Thanks!
I need to disable and move orphaned computer objects in my Active Directory. The SQL Agent has permission to do this. I have created a stored procedure for the task with intentions of executing it with sp_start_job. However, I cannot execute it in SQL 2005. How can I grant permission to this (login) to execute sp_start_job? This is all run from a web page and NOT the Query Window.
Please anyone help me with my question How do I execute a stored Procedure using SSIS ? I have a stored procedure in SQL SERVER 2005 database that I need to execute using a SSIS package using Execute SQL Task from Toolbox in Visual studio 2005
Hi, I am strugling to execute a insert stored procedure on a button click. The stored procedure is taking values from a temp table and inserting them into a identical table. The procedure is expecting 1 value from a Query string, the stored procedure works as expected when hard coded.
Im completely new to this and have no idea where to begin, i have been looking through the forums for several hours and am still none the wiser.
please can someone point me in the right direction
i have a stored procedure and i want to run a program from it.. i think that i need use api functions but how can i do that.. if there is a nother ways please tell me..
I have a button in a form that I want to execute a simple stored procedure to insert a single value into a database table. The Stored Procedure is:=================CREATE PROCEDURE bplog_insert_invoice_detail (@invo_Id Int) ASINSERT INTO Invoice_Detail (Invo_Id) VALUES(@Invo_Id)GO=================How do i pass the value from and text field (@invo_id) and execute the stored procedure when a button is clicked.Regards.
Hello,I was wondering if it is possible to dynamically execute a stored procedure; for example, in SQL, you can do:insert into Table1( id, name)select id, namefrom Table2Can you do something like:exec spProc @id = id, @name = namefrom Table1Or something like that? I know I can select a row at a time and execute, or write a program, but I was looking to see if there was an easier way.Thanks.
Hello, I'm having trouble trying to execute a simple stored procedure. Could someone please take a look at this and let me know where I went wrong. Dim cn As SqlConnection = New SqlConnection("Data Source=localhost;Initial Catalog=TEST;Persist Security Info=True;User ID=sa;Password=test") Dim cmd As SqlCommand = cn.CreateCommand cn.Open() cmd.CommandText = "cssp_family" cmd.CommandType = CommandType.StoredProcedure cmd.ExecuteNonQuery() cn.closed
Within a stored procedure, is it possible to call multiple other stored procedures asychronously? For example, I'd like to execute both local and remote stored procedures, but don't want/need to wait for the output while the original stored procedure continues to execute each subsequent command.
Hi, hoping someone may be able to shed some light on this.
I have a stored procedure that conditionally executes different DTS Packages. Everything seems to work, there's no errors at all, but the DTS Packages are never executed. Wondering if anyone has any ideas.
Here's the stored procedure....
CREATE PROCEDURE exportLists AS
DECLARE @script VARCHAR(8000) DECLARE @id INT DECLARE @max INT
select regionid,count(distinct homephone) as phone into #phone from tbl_template Where exportid is null group by regionid
select officeid,listpath into #office from tbl_office WHERE startdate <= GETDATE() AND (enddate >= GETDATE() OR enddate IS NULL) and listpath is not null and listpath <> ''
Select case when phone > 2500 then '"exportLists" /A MDBFile="' + listpath + '" /A OfficeID ="' + convert(varchar(10),officeid) + '" ' Else '"resetTemplate" /A OfficeID="' + convert(varchar(10),officeid) + '" ' end as cmd ,Identity(int,1,1) as rowno ,phone into #temp from #office as O inner Join #phone as p on o.officeid=p.regionid
Set @max=@@rowcount set @id = 1
While @id <=@max Begin Select @script='"Dtsrun /S "' + @@SERVERNAME + '" /E /N ' + cmd + case when phone > 2500 then '/A ExportID="' + convert(varchar(10),(Select coalesce(Max(listid),0) + 1 from tbl_sf3Lists)) + '" ' else ' ' end , @id=@id+1 from #temp Where rowno = @id End
Which fixed database role allows a user to execute a user defined stored procedure while minimizing the amount of permissions given. I think db_Datareader will do the trick.
I am trying to execute the following simple stored procedure. The procedure runs but doesn't create the table I am trying to create and doesn't insert the records into the table I created. But again, the procedure runs without any errors.
Can someone please correct the syntax so my procedure will run properly. It pretty basic.
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO
CREATE PROCEDURE [dbo].[PremierData1]
AS
IF EXISTS(SELECT 1 FROM sys.sysojects where type='U' AND name='PremierTest') DROP TABLE dbo.[PremierTest]
BEGIN
CREATE TABLE dbo.[PremierTest] ( [AYQ] nvarchar(6) null , [CYQ] nvarchar(6) null , [Description] nvarchar(50) null, [PIP] [decimal] (17,2) , [BI] [decimal](17,2) Not null, [PD] [decimal](17,2) Not null, [COLL] [decimal](17,2) not null, [COMP] [decimal](17,2) not null, [DCRAT] [nvarchar](2) null , [Agent][nvarchar](3) null , ) ON [Primary]
insert into dbo.premiertest select * from dbo.[new agt type tri 0804] where dir_ceded_ind = 'c'
I don't know if this is a newbie question or not, I want SQL Server to automatically execute a stored procedure at the first of each month, how can I do this ?
Regards, AJ
Be nice to nerds. Chances are you'll end up working for one. (Bill Gates)