Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Employee code(takes two letters from employee name and append number to it.,e.g.:-ga1,om2),
Employee name(e.g.ganesh,omkar),mobile,gender,address,state,city
.
.
.
where ga1=ganesh(emp_name)
om2=omkar
Posted
Comments
Gitanjali Singh 8-Jan-14 5:26am    
Have you tried like operator?
Rajnish D mishra 8-Jan-14 5:40am    
by using substring i geting two alfhbet of emp_name but i have problam at after how to give sequence for apend name like ga1 ,om2,ra3...etc

1 solution

In SQL you can do in this way ::

SQL
select left(empname,2)+cast( ROW_NUMBER() over(order by empname) as varchar) from table_employee


---where empname is the name of employee and table_employee is the name of table .
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900