用vb调用如下sql语句:
select convert(varchar(1),a)+convert(varchar(1),b) as c from test;
---
以上,希望对你有所帮助。
-- a b 类型为varchar
declare @t1 table(a varchar(10),b varchar(10))
insert into @t1
select '1','1' union
select '2','2' union
select '3','3'
select a+b c from @t1
--a b类型为int
declare @t2 table(a int,b int)
insert into @t2
select 1,1 union
select 2,2 union
select 3,3
select cast(a as varchar)+cast(b as varchar) c from @t2
--结果如下:
(3 个资料列受到影响)
c
--------------------
11
22
33
(3 个资料列受到影响)
(3 个资料列受到影响)
c
------------------------------------------------------------
11
22
33
(3 个资料列受到影响)
insert into test1 select a,b,a+b as c from test
select * from test1