Experts - can you please help:
I have the sp which has some piece of code as below:
FROM GrpTb g
LEFT OUTER JOIN ccProfile sc
ON sc.prod_group = g.group_name
where g.group_type = 'PRDGRP'
and g.id = @prmId
having count(sc.prod_group) >0
select @varErrorDescription = 'The group ' || convert(varchar,@prmId) || ' can not be deleted, this group is in use.'
raiserror 99999, @varErrorDescription
so above checks -- if group is in use --- it should raise an error with the description that group is in use can so cannot be deleted.
But I am getting messages as below:
in results :
1> exec delProductGroup 1, 'ss'
Msg 2748, Level 16, State 1:
Server 'RDS', Procedure 'delProductGroup', Line 30:
Message number 99999, passed to RAISERROR, does not exist in the sysusermessages catalog.
Procedure 'delProductGroup' attempted to return a status of NULL, which is not allowed. A status of 0 will be returned instead.
(return status = -6)
What is happening? please help