Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails
CREATE PROCEDURE [dbo].[sproc_cart_Insert_Order] @UserID Int, @TempID nvarchar(100) AS BEGIN TRANSACTION DECLARE @rInserted INT DECLARE @rUpdated INT INSERT INTO dbo.OrderDetail ( ProductId, Price, Qty, SetSize, Colour, Gather, MaterialDrop, StatusID, Width, Metrics, UserID, TempID, WhichRoom ) SELECT ProductID, Price, Qty, SetSize, Colour, Gather, MaterialDrop, 1, Width, Metrics, @UserID, TempID, WhichRoom FROM dbo.CartItems WHERE (TempID = @TempID) SET @rInserted = @@ROWCOUNT UPDATE p SET Qty = p.Qty - ci.Qty FROM Product p JOIN Cartitems ci ON p.[Id] = ci.productid AND p.Qty >= ci.Qty AND ci.TempID = @TempID SET @rUpdated = @@ROWCOUNT IF @rUpdated < @rInserted BEGIN -- not all products had enough Qty!! ROLLBACK RAISERROR ( 'Not all products are available in the Qty requested', 16,2 ) WITH SETERROR END ELSE BEGIN COMMIT END GO
|Compare and update data between two databases||6||31|
|IF SQL Statement Access SQL||6||38|
|Fixing Temp Table inside dynamic query||4||71|
|I've just downloaded and installed ApexSQL, but I don't see the Search Text option...||3||44|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
10 Experts available now in Live!