How do you take out extra spaces in query

Hello I have a problem how do i delete any blank spaces
 5185  INTERNAL AUDITING             .(--this is where this blank space stops)
I only want one space in between each space and it adds 5 to 6 spaces in the front or in the back of each query some titles are longer than others but i dont know why its doing this. I am also putting 2 tables into 1 I am combining the call center and the name of department together
dbo.AS400_CEmployee.Department + ' ' + CAST(dbo.AS400_CEmployee.Department_Desc AS varchar(40)) AS department

Open in new window

LVL 1
kuintencstAsked:
Who is Participating?
 
Patrick MatthewsConnect With a Mentor Commented:
LTRIM(RTRIM(dbo.AS400_CEmployee.Department + ' ' + CAST(dbo.AS400_CEmployee.Department_Desc AS varchar(40)))) AS department
0
 
jbulldozaConnect With a Mentor Commented:
Try using rtrim -

rtrim(dbo.AS400_CEmployee.Department) + ' ' + rtrim(CAST(dbo.AS400_CEmployee.Department_Desc AS varchar(40)) AS department)
0
 
kuintencstAuthor Commented:
Thank you both worked like a charm
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.