Increment id in table

Dear sir
Goodmorning.
I have two table, one is TBL_EMP and second is TBL_DEPARTMENT
TBL_EMP
EMPID, DEPTID, EMPNAME, DOJ, DOB .....

TBL_DEPARTMENT
DEPTID, DEPTNAME

DEPTNAME are executive, developer

I have require empID ex1001, dev1002, and so on.............

You can add identity column in TBL_Emp and make EmpID as computed column which will have values combined of DeptID and Identity Column. It's better to make computed column persisted for better performance.

1 Like