Click here to Skip to main content
15,918,168 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i want to select Student id and his name in sql server.
like Anmol Sahrma---------->R200911100001.

i'm try to do like that

select stu_name + '---------->' + Reg_id from student.

Error is
Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value 'Anmol Sahrma ----->' to data type int.

Can any one help me?
Posted

Try
select stu_name + '---------->' + CONVERT(varchar, Reg_id) from student
.
Reg_id needs to be converted to string before it is concatenated.
 
Share this answer
 
Comments
m@dhu 5-Feb-11 1:19am    
Good one.
Abhinav S 7-Feb-11 8:24am    
Thanks.
Instead of Convert Varchar to int try Int to Varchar.
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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