Dear Sir
How to create employee id number auto increment number like EMP1001
give example script coding
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
shubhangi khandalePosted Dec 21, 2011, 4:15 AM
Write following formula for this if u use sql server then to go this column property computed column specification then write
formula ((''EMP+left([empID,(5)))+convert([varchar],[empid],(0)))
and
is Persisted =yes
Pravin GhadgePosted Dec 20, 2011, 6:49 AM
try this:
declare @temp as char(15)
set @temp=(select max(right(Itemcode,6)) + 1 from tblname
where (left(itemcode,3)='EMP'
set @temp='EMP'+isnull(replicate(0,6-len(@temp)),'')+@temp
select isnull(cast(@temp as char(15)),'EMP100001')