April 16, 2006 at 5:02 am
I better not comment the code. Just for a purpose not to appear rude.
But you cannot supply empty string as a parameter to your SP because all of your parameters are integer. You MUST supply a number, otherwise your call for SP will fail.
You must do this check and replacement in your application code.
_____________
Code for TallyGenerator
April 16, 2006 at 11:54 am
thats for the help.
yeh im quite new to sql, and self taught at that. in what way should i alter the code to make it "nicer"? just for reference.
its a uni project so as long as it works they arent that bothered.
thanks,
ben
April 16, 2006 at 8:44 pm
Ben,
Why not make the ConsultancyBookingNumber column in the Consultancy table and IDENTITY column instead of using MAX+1? Then, you wouldn't even need this procedure as the column would be auto-numbering and auto-incrementing...
--Jeff Moden
Change is inevitable... Change for the better is not.
April 17, 2006 at 9:34 am
Some more suggestions:
In addition to making the ConsultancyBookingNumber an ID column, you could also specify default values (of NULL) for the various parameters so you don't have to do any checking..
eg:
create proc ben_sp_state1 @clientid numeric(9) = NULL, @ConsultantID numeric(9)= NULL, etc...
This way if the values are not supplied, null is inserted - else the values!
You could make the default on your ConsultancyStateID colum '1' (this is a char/varchar column ?!?!?!) so you don't have to include it in your insert statement...
You have ConsultancyDate as a numeric datatype - that should be changed to datetime/smalldatetime so you can perform date calcs when/if needed!
**ASCII stupid question, get a stupid ANSI !!!**
Viewing 4 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply