Hi all,
I’m having some trouble with LP_TICKET_ELEMENTS (again…me and this procedure don’t get along so well!). My code works perfectly fine when I run it as a query, however when I execute the stored procedure with exactly the same parameter values, the OUTPUT parameter @ude_value is always returned as NULL. The code below is followed from how SQL forums use output parameters so I don’t know what I’m missing, but it’s obviously something….
USE [impresario]
GO
DECLARE
@return_value int,
@ude_value varchar(30)
EXEC @return_value = [dbo].[LP_TICKET_ELEMENTS]
@ude_no = 1,
@li_seq_no = 1422826,
@cur_sli_no = 3467188, --3467187,
@payment_no = NULL,
@print_unprinted = 'Y',
@reprint_printed = 'Y',
@sli_req_no = 3467188, --3467187,
@au_set_no = NULL,
@order_no = 1085403,
@customer_no = 568013,
@design_no = 2173,
@design_type = 'T',
@ude_value = @ude_value output
SELECT @ude_value as N'@ude_value'
SELECT 'Return Value' = @return_value
Here is the actual procedure:
ALTER Procedure [dbo].[LP_TICKET_ELEMENTS](
@ude_no int = null, -- 1-6
@li_seq_no int = null,
@cur_sli_no int = null,
@payment_no int = null,
@print_unprinted char(1) = null,
@reprint_printed char(1) = null,
@sli_req_no int = null,
@au_set_no int = null,
@order_no int = null,
@customer_no int = null,
@design_no int = null,
@design_type char(1) = null,
@ude_value as varchar(30) output
)
/* I also tried:
@ude_value varcahr (30) = '' output
@ude_value varcahr(30) output
None of which gave syntax erros, but none of which I could get to work. */
AS
Set NoCount On
Return
If @ude_no = 1
and @customer_no > 0
and @design_type = 'T'
BEGIN
Select @ude_value =
case when c.id = '29' then short_desc
else b.seat_row + ' ' + b.seat_num
End
from
T_SUB_LINEITEM a
join T_SEAT b on a.seat_no=b.seat_no
join TR_SECTION c on b.section=c.id
join T_ORDER d on a.order_no=d.order_no
where customer_no = @customer_no
and a.sli_no = @cur_sli_no
END
Also, does anyone know the difference between the parameters @cur_sli_no and @sli_req_no?
Thanks for any helps as always!