开发者

concatenate two columns with equal space

开发者 https://www.devze.com 2023-02-09 23:57 出处:网络
edit SELECT(dbo.County.CountyName + \' (\' + dbo.State.StateName + \' ) \') AS CountyName from Table1 i am adding two columns for an example:

edit

SELECT  (dbo.County.CountyName + ' (' + dbo.State.StateName + ' ) ') 
AS CountyName from Table1

i am adding two columns for an example:

CountyName + '(' + StateName + ')'

how can i make sure or have fixed width of CountyName so that it looks neat/clean

for an example:

Torrance     (California)
Torrance     (Chicago)
Cook         (Chicag开发者_运维技巧o)
....


select CountyName + space(20-len(CountyName)) + '(' + StateName + ')'...
0

精彩评论

暂无评论...
验证码 换一张
取 消