[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

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

0
kuintencst
Asked:
kuintencst
2 Solutions
 
Patrick MatthewsCommented:
LTRIM(RTRIM(dbo.AS400_CEmployee.Department + ' ' + CAST(dbo.AS400_CEmployee.Department_Desc AS varchar(40)))) AS department
0
 
jbulldozaCommented:
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now