I'm sure there is a billion ways to do this but I'm trying to return the ID for the insert which would be the purchase id.
code:
IF EXISTS(SELECT [Email] FROM [dbo].[WBG_User] WHERE [Email] = @Email) BEGIN --Update Products UPDATE [dbo].[WBG_User] SET [User_Products] = [User_Products] + @ProductName + ';' WHERE [Email] = @Email; --User Account Balance UPDATE [dbo].[WBG_User] SET [WBG_Coins] = [WBG_Coins] - @Amount WHERE [Email] = @Email; --Create Receipt INSERT INTO [dbo].[WBG_Purchase] (Email, Product_Name, Purchase_Date, Purchase_Amount) VALUES (@Email, @ProductName, @PurchaseDate, @Amount) SET @PurchaseID = (SELECT SCOPE_IDENTITY()); END ELSE BEGIN SET @Response = 'No User Found'; END
Currently returns as null