求字符相加带'/'的SQL语句
我要得到如
1/2
11122/434343
...
的字符串
select a+ '/ '+b from c
应该怎么改???
------解决方案--------------------我要得到如
1/2
11122/434343
...
的字符串
select a+ '/ '+b from c
应该怎么改???
-------------------------------------
select cast(a as varchar)+ '/ '+cast(b as varchar) from c
------解决方案--------------------create table c(a int,b int)
insert into c select 1,1
union select 2,2
union select 3,5
union select 4,1
go
select Convert(varchar(20),a)+ '/ '+Convert(varchar(20),b) from c
drop table c
----------------------------------
(无列名)
1/1
2/2
3/5
4/1
------解决方案--------------------樓上正解
------解决方案--------------------楼上楼上正解
------解决方案--------------------select a+ '/ '+b from c
应该怎么改???
----------------------------
Select rtrim(a)+ '/ '+rtrim(b) From c
------解决方案--------------------Select ltrim(a)+ '/ '+ltrim(b) From c
嘿嘿