Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
I am Mohan, I have One Doubt for SQl Query.

Two Different Data types Are there For Example : Int and String

Okey

Now I Concatenating This Two Columns in a Query...

Please Help Me as Soon As Possible...

With Regards Mohan...
Posted

You have to use Cast or Convert[^]

Select CONVERT(varchar, intColumn) + strColumn ... from tablename
 
Share this answer
 
v2
Comments
m@dhu 15-Apr-11 7:59am    
your query gives error. ;P
Prerak Patel 15-Apr-11 8:04am    
using MSSQL?!! no way!!
I have used it many times
:omg:
m@dhu 15-Apr-11 8:10am    
Did you check the tag SQL-Server.
m@dhu 15-Apr-11 8:10am    
And I was talking about '...'
Prerak Patel 15-Apr-11 22:43pm    
and that is for the other parts OP may want to select. '...' is not the part of SQL.
Dear Mohan,

you can cast or convert one column to anther's datatype while you are concatenating the columns. E.g.

--Here CustomerId is Int and CustomerAdd is Varchar
Select Cast(CustomerId As Varchar(10)) + CustomerAdd from tblCustomer


Regards!
Aman
 
Share this answer
 
v2
Comments
Mohankumar.Engain 15-Apr-11 8:15am    
thanks for u

by mohan bye bye....

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