SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Server Service Broker Updating Stored procedure


SQL Server Service Broker Updating Stored procedure

Author
Message
Ali Zaman
Ali Zaman
Grasshopper
Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)

Group: General Forum Members
Points: 20 Visits: 5
how can you update the service broker stored procedure. when i update the stored procedure the changes dont come into affect. i have tried to alter the queue, waited for all jobs to finish, but some how still the old stored procedure is running. is there any way i can force changes to the stored procedure.

i have tried sql profiler tracing but that didnt show any changes.


ALTER PROCEDURE [dbo].[ServiceBroker_AtTarget_FromSLICJobEstimateDetailsNewLineAddedBySupplier]
@XML XML(SLICMessageSchema)
AS
BEGIN
-- extract data :
DECLARE
@LogNo INT,
@QuoteReference INT,
@JobEstimatesDetailID INT,
@UserName NVARCHAR(50),
@Description NVARCHAR(MAX),
@UnitValue DECIMAL(18,2),
@Quantity DECIMAL(18,2),
@LineTotal DECIMAL(18,2),
@QuoteTotal DECIMAL(18,2),
@tsCreated DATETIME

SELECT @QuoteReference = @XML.value('data(//FromSLIC/FromSLICJobEstimateDetailsNewLineAddedBySupplier/@QuoteReference)[1]', 'int'),
@JobEstimatesDetailID = @XML.value('data(//FromSLIC/FromSLICJobEstimateDetailsNewLineAddedBySupplier/@JobEstimatesDetailID)[1]', 'int'),
@UserName = @XML.value('data(//FromSLIC/FromSLICJobEstimateDetailsNewLineAddedBySupplier/@UserName)[1]', 'nvarchar(50)'),
@Description = @XML.value('data(//FromSLIC/FromSLICJobEstimateDetailsNewLineAddedBySupplier/@Description)[1]', 'nvarchar(max)'),
@UnitValue = @XML.value('data(//FromSLIC/FromSLICJobEstimateDetailsNewLineAddedBySupplier/@UnitValue)[1]', 'decimal(18,2)'),
@Quantity = @XML.value('data(//FromSLIC/FromSLICJobEstimateDetailsNewLineAddedBySupplier/@Quantity)[1]', 'decimal(18,2)'),
@tsCreated = @XML.value('data(//FromSLIC/FromSLICJobEstimateDetailsNewLineAddedBySupplier/@tsCreated)[1]', 'datetime')

SET @LogNo = (SELECT mlq.logno FROM fsgmgtservices.dbo.maintlogquotes mlq WHERE mlq.quoteno = @QuoteReference)

INSERT INTO fsgcentraldata.dbo.[tblSLICGeneratedEvents]
(EventNameID, tsCreated, CreatedBy, IsAcknowledged, JobNumber, ContractorID)
SELECT 9, @tsCreated, @UserName, 0, @LogNo, je.contractorid
FROM [slic3.0].dbo.JobEstimates je WHERE je.legacyreference = CAST(@quotereference AS varchar(50))



SET @LineTotal = (@UnitValue * @Quantity) // IF I CHANGE IT TO ((@UnitValue * 2)) FOR EXMPL



INSERT INTO fsgmgtservices.dbo.maintlogquotedetails
(quoteno, details, quantity, rate, amount, [date], slicreference)
SELECT @QuoteReference, @description, @quantity, @UnitValue, @LineTotal, @tscreated, @JobEstimatesDetailID

SET @QuoteTotal = (SELECT SUM(mlqd.amount) FROM fsgmgtservices.dbo.maintlogquotedetails mlqd
WHERE mlqd.quoteno = @QuoteReference)

UPDATE fsgmgtservices.dbo.maintlogquotes SET amount = @QuoteTotal WHERE quoteno = @QuoteReference

INSERT INTO [fsgmgtservices].[dbo].maintlognotes
(logno, [date], [user], [note], transferredfromslic)
SELECT @LogNo, @tsCreated, @UserName, 'Quote ' + CAST(@QuoteReference AS varchar(20)) + ', new lines added by supplier in SLIC By ' + @UserName , 0

END
WolfgangE
WolfgangE
SSC-Addicted
SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)

Group: General Forum Members
Points: 495 Visits: 793
hi there,

I think you are talking about the activation procedure for the queue.
This is a procedure like any other store procedured. Just alter it as usual.

Get sure that your procedure is actual bound to the queue. Maybe you are changing another procedure but not the current activation procedure.
Use the ALTER QUEUE command to bind your procedure to the queue or check the table sys.service_queues, there you can find the current activation procedure.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search