可以将两个不同的数据类型关联到一个查询吗? [英] Is It Posible Two Different Data Types Cancatenating a single Query?
本文介绍了可以将两个不同的数据类型关联到一个查询吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Mohan,我对SQl查询有疑问.
有两种不同的数据类型,例如:Int和String
奥基
现在,我在查询中串联这两列...
请尽快帮助我...
使用问候Mohan ...
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...
推荐答案
,您必须使用^ ]
You have to use Cast or Convert[^]
Select CONVERT(varchar, intColumn) + strColumn ... from tablename
亲爱的莫汉,
您可以在串联各列时将一列转换为或转换为花药的数据类型.例如
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
这篇关于可以将两个不同的数据类型关联到一个查询吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文