Ihave written code for Auto increment for Itemcode which is :
declare @temp as char(15)
set @temp=(select max(right(Itemcode,6)) + 1 from OITM where (left(itemcode,3)='ITM'))
select isnull(cast(@temp as char(15)),'ITM000001')
The code is running propelrly when iam refreshing UDF at Add mode. But when iam refreshing at Update mode it is going to give me next autoid.
I know that i have not given TransactionType parameter to specify Add or Update.
How should i specify the Add or update mode in this querry?
Please give me any suggestion as soon as possible.