Go Premium for a chance to win a PS4. Enter to Win

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

Concatination

I am writing a query that will concatinate 4 field in SSRS SQL builder.  I keep getting an error on the " & " (ampersand).  
Any help is appreciated on how to concatinate the following fields and put spaces in between each field.

MyTable.HOUSE_DIRECTION & " " &
MyTable.STREET_NAME & " " &
MyTable.STREET_MODE & " " &
MyTable.APARTMENT_UNIT_NUMBER
0
donnie91910
Asked:
donnie91910
  • 5
  • 3
  • 3
  • +2
1 Solution
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Where exactly is the above code?

If it's T-SQL, then the double quotes should be single quotes

If it's in an SSRS expression, then it should be...
=Fields!HOUSE_DIRECTION.Value & " " & 
Fields!MyTable.STREET_NAME.Value & " " & 
Fields!MyTable.STREET_MODE.Value & " " & 
Fields!MyTable.APARTMENT_UNIT_NUMBER.Value

Open in new window

0
 
donnie91910Author Commented:
the above code is in the list of fields that I want displayed in my query:

MyTable.FirstName,MyTable.LastName,
MyTable.HOUSE_DIRECTION & " " &
MyTable.STREET_NAME & " " &
MyTable.STREET_MODE & " " &
MyTable.APARTMENT_UNIT_NUMBER
,MyTable.City,MyTable.State,MyTable.ZipCode
0
 
ValentinoVBI ConsultantCommented:
If it's T-SQL, then the double quotes should be single quotes

Good catch Jim, but there's another issue: ampersand is not the string concatenator, + sign is.  So in T-SQL it would become:

MyTable.HOUSE_DIRECTION + ' ' +
MyTable.STREET_NAME + ' ' +
MyTable.STREET_MODE + ' ' + 
MyTable.APARTMENT_UNIT_NUMBER

Open in new window

0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Correct.
0
 
donnie91910Author Commented:
This data is from an Oracle database.
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>This data is from an Oracle database.
Dude, you need to tell us these things upfront.  Since the zone was only MS SQL Reporting, we assumed SQL Server.

I'll add the Oracle zone to this question so those experts can respond.
0
 
donnie91910Author Commented:
I apologize.
0
 
DavidSenior Oracle Database AdministratorCommented:
Oracle by default uses the double bar, || to join and single quote ' to delimit.

MyTable.HOUSE_DIRECTION || ' ' ||MyTable.STREET_NAME || ' ' ||
MyTable.STREET_MODE || ' ' || MyTable.APARTMENT_UNIT_NUMBER
0
 
donnie91910Author Commented:
Ok, I am writing this query in SSRS query designer, but I am querying against an Oracle database.  I am getting an error when I use the double bar in SSRS query designer.  Does anyone have any ideas why?
0
 
ValentinoVBI ConsultantCommented:
It would help if you could let us know what the error says, and what Oracle provider you're using.
0
 
donnie91910Author Commented:
the Oracle version that is being used is 11.1.0 client.  See attached for error.
Concatinate-error.jpg
0
 
ValentinoVBI ConsultantCommented:
Can you paste your full query as well, according to the error there's something wrong with it.
0
 
Steve WalesSenior Database AdministratorCommented:
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 3
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now