ÎÒÏë°ÑÁ½Áкϲ¢ ±ä³É 100:ff 101:ff 102:gg SQL code: --> ²âÊÔÊý¾Ý: #tb if object_id('tempdb.dbo.#tb') is not null drop table #tb go create table #tb (A int,B varchar(2)) insert into #tb select 100,'ff' union all select 101,'dd' union all select 102,'gg'
select cast(A as varchar(10))+':'+B from #tb
------------- 100:ff 101:dd 102:gg
(3 ÐÐÊÜÓ°Ïì)
select ltrim(a) + ':' + b from tb
select cast(a as varchar) + ':' + b from tb
SQL code:
select rtrim(ltrim(A))+':'+rtrim(ltrim(B)) from tt