Jump to content

Recommended Posts

Could someone please help? The code is the following


CREATE PROCEDURE hire_toy @memberid int = NULL, @toyid int = NULL, @hiredate datetime = NULL AS --IF @memberid = NULL PRINT 'Mem is null' --IF @toyid = NULL PRINT 'toy is null' --IF @hiredate = NULL PRINT 'hiredate is null' IF(@memberid = NULL OR @toyid = NULL OR @hiredate = NULL) BEGIN RAISERROR('Please enter all required parameters: Member id, Toy id, Hiredate',16,1) RETURN END print 'debug 0' INSERT INTO Hire (Member_Id, Toy_Id, Hire_Date) VALUES (@memberid, @toyid, @hiredate) print 'debug 1' IF @@ERROR <> 0 BEGIN print 'error occured' END ELSE BEGIN print 'updating toy status: id: ' + CONVERT(varchar(16), @toyid) UPDATE Toys SET Status = 'Hired' WHERE Id = @toyid END print 'debug 2'

- Only gets output of: debug 0 - Updates fine but nothing beyond the insert is executed!?

So once the information has been inserted into Hire it does nothing else? It seems strange is there anyone who can help?
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.