Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenating blank strings

Status
Not open for further replies.

seekwall

Programmer
May 14, 2001
41
GB
I need to be able to derive a single name field from 4 other fields. If I do the following as an example:

declare @title varchar(20)
select @title = 'Mr'
declare @inits varchar(20)
select @inits = 'J'
declare @forename varchar(20)
select @forename = ' '
declare @surname varchar(20)
select @surname = 'Doe'
print @title+' '+@inits+' '+@forename+' '+@surname

I get "Mr J Doe" returned, which is correct.

What I need to do is to be able to return only one space bewteen each populated string no matter where there are blank strings.

Anyone got any ideas ?



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top