[dbo].[MssWebUpdateDocumentProperties]
CREATE PROCEDURE [dbo].[MssWebUpdateDocumentProperties]
@inOrderId int,
@inDocumentId int,
@inDocumentTypeId int,
@inDescription varchar(64),
@inNote varchar(256),
@inWorkTicketNumber varchar(32)
AS
BEGIN
set nocount on
;with WorkTicketsCTE as ( SELECT TOP 1 WorkTicketID FROM WorkTickets
Where WorkTickets.WorkTicketNumber = @inWorkTicketNumber)
UPDATE MssDocument set
DocumentTypeFID = @inDocumentTypeId,
DocumentDescription = @inDescription,
DocumentNotes = @inNote,
WorkTicketFID = WorkTicketsCTE.WorkTicketID,
LastModified = getdate()
FROM MSSDocument
OUTER APPLY WorkTicketsCTE
where MssDocument.OrderFID = @inOrderId and
MssDocument.MSSDocumentID = @inDocumentId
END
GO
GRANT EXECUTE ON [dbo].[MssWebUpdateDocumentProperties] TO [MssExec]
GO