Nick Kahn
Nick Kahn

Reputation: 20078

concatenate two columns with equal space

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         (Chicago)
....

Upvotes: 1

Views: 3763

Answers (1)

Joe Stefanelli
Joe Stefanelli

Reputation: 135818

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

Upvotes: 1

Related Questions