ALTER PROCEDURE [dbo].[p_CreateWO] ( @WOID INTEGER, @CustomerID INTEGER, @DeptID INTEGER, @SiteID INTEGER, @WODate DATE, @WODueDate DATE, @WONumber nvarchar(255), @WORequestedByID INTEGER, @WOPreparedByID INTEGER, @WONotes nvarchar(MAX), @WOTotalVAT INTEGER, @WOTotalPrice INTEGER, @WOSignedForID INTEGER, @WODeliveryDate Date, @WOCompletedDate Date, @StatementType nvarchar(20) = '' ) AS BEGIN IF @StatementType = 'Insert' BEGIN insert into tblWorkOrderHead (CustomerID, DeptID, SiteID, WODate, WODueDate, WONumber, WORequestedByID, WOPreparedByID, WONotes, WOTotalVAT, WOTotalPrice, WOSignedForID, WODeliveryDate, WOCompletedDate) values( @CustomerID, @DeptID, @SiteID, @WODate, @WODueDate, @NextWO, @WORequestedByID, @WOPreparedByID, @WONotes, @WOTotalVAT, @WOTotalPrice, @WOSignedForID, @WODeliveryDate, @WOCompletedDate) END IF @StatementType = 'Select' BEGIN select * from tblWorkOrderHead WHERE WOID = @WOID END IF @StatementType = 'Update' BEGIN UPDATE tblWorkOrderHead SET DeptID = @DeptID, SiteID = @SiteID, WODate = @WODate, WODueDate = @WODueDate, WORequestedByID = @WORequestedByID, WOPreparedByID = @WOPreparedByID, WONotes = @WONotes, WOTotalVAT = @WOTotalVAT, WOTotalPrice = @WOTotalPrice, WOSignedForID = @WOSignedForID, WODeliveryDate = @WODeliveryDate, WOCompletedDate = @WOCompletedDate WHERE WOID = @WOID END else IF @StatementType = 'Delete' BEGIN DELETE FROM tblWorkOrderHead WHERE WOID = @WOID END end
ALTER Procedure [dbo].[p_GetNewWONumber] (@NextWO INT OUT ) AS BEGIN SET NOCOUNT ON; SELECT @NextWO = COALESCE(MAX(WONumber), 0) +1 FROM tblWorkOrderHead RETURN @NextWO END
Gain unlimited access to on-demand training courses with an Experts Exchange subscription.Get Access
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE
Connect with Certified Experts to gain insight and support on specific technology challenges including: