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
donnie91910Asked:
Who is Participating?
 
DavidConnect With a Mentor Senior 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
 
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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
 
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
 
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
All Courses

From novice to tech pro — start learning today.