| Author |
Topic |
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2005-10-05 : 11:11:31
|
| I want to update 2 tables in one sp as the parameters are the same. Here's my sp and I don't get any syntax errors in Ent manager, but the error 'Incorrect syntax near 'spRB_CancelFacMenuBooking' when I run it.CREATE PROCEDURE spRB_CancelFacMenuBooking@strBookingNo integer,@strCancelled bit,@strCancelledDate datetime,@strCancelledBy nvarchar(100)ASBEGINUPDATE tblRB_FacilitiesBookings SETFB_Cancelled =@strCancelled,FB_CancelledDate=@strCancelledDate,FB_CancelledBy=@strCancelledByWHERE FB_BookingNo = @strBookingNoENDBEGINUPDATE tblRB_MenuBookings SETMB_Cancelled =@strCancelled,MB_CancelledDate=@strCancelledDate,MB_CancelledBy=@strCancelledByWHERE MB_BookingNo = @strBookingNoENDGO |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2005-10-05 : 11:23:32
|
you forgot the "( )"CREATE PROCEDURE spRB_CancelFacMenuBooking(@strBookingNo integer,@strCancelled bit,@strCancelledDate datetime,@strCancelledBy nvarchar(100))ASDuane. |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2005-10-05 : 11:27:09
|
| I still get the same error..... |
 |
|
|
mmarovic
Aged Yak Warrior
518 Posts |
Posted - 2005-10-05 : 11:31:06
|
| [code]CREATE PROCEDURE spRB_CancelFacMenuBooking@strBookingNo integer,@strCancelled bit,@strCancelledDate datetime,@strCancelledBy nvarchar(100)ASBEGINUPDATE tblRB_FacilitiesBookings SETFB_Cancelled =@strCancelled,FB_CancelledDate=@strCancelledDate,FB_CancelledBy=@strCancelledByWHERE FB_BookingNo = @strBookingNoUPDATE tblRB_MenuBookings SETMB_Cancelled =@strCancelled,MB_CancelledDate=@strCancelledDate,MB_CancelledBy=@strCancelledByWHERE MB_BookingNo = @strBookingNoENDGO[/code]However, It would bu usefull if you add error handling. |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2005-10-05 : 11:35:06
|
| Thanks for your help. How would I add error handling ? I am going to put Try etc around my sp call in my asp.net code. |
 |
|
|
mmarovic
Aged Yak Warrior
518 Posts |
Posted - 2005-10-05 : 11:40:37
|
You can also add transactions. if not then at least after each update add:if @@error <> 0 return <integer error code> also add at the end of proc: return 0 and check return value in your .net code. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2005-10-06 : 04:00:28
|
| I am still getting the same error when I run the sp. I will create two instead. |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2005-10-06 : 04:29:34
|
| how are you calling the sp?--------------------keeping it simple... |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2005-10-06 : 04:31:09
|
| I've sorted it now - typo I'm afraid... |
 |
|
|
|