Hi,I have a tableCustomerDetailcustomeridcustomernamestatusapp_nodeskno Now everytime a new customer is created, i allocate the deskno. The logic I use is create proc spoc_incrementdeskasDECLARE @deskno intselect @deskno = (SELECT max(deskno) from customerdetail)Insert into customers(1,'rick',1,23232,@deskno)
If there are already records present in the customer table, it works well. However if the very first record is getting inserted it inserts null in the deskno because when no records are present (max(deskno) = null).At time time of insertion, how do i check if @deskno = null and allot it 1.thanks