Hi All,

I have this stored procedure that works well in SQL2005 bu get errors when trying to create it in Sybase. I could really need some help.

Basically all it does is lock the table while getting the single row of data for a ConsumerID number and adds one for return then unlocks ready for the next execution.

Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER       PROCEDURE [dbo].[get_consumerID] @outvar char(9)  output
AS 
declare @ConsumerID as decimal


begin transaction
TABLOCKX
select @ConsumerID=fnConsumerID
from tblConsumerNo 

if @ConsumerID is null
begin
      set @ConsumerID = 1
      insert fnConsumerID values( @ConsumerID)
end
else
begin
      update tblConsumerNo  set fnConsumerID = @ConsumerID + 1
end
select @ConsumerID
set @outvar = @ConsumerID
commit transaction