Solved

Concatination

Posted on 2014-04-08
14
119 Views
Last Modified: 2014-06-09
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
Comment
Question by:donnie91910
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
  • +2
14 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39987699
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
 

Author Comment

by:donnie91910
ID: 39987970
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
 
LVL 37

Expert Comment

by:ValentinoV
ID: 39988304
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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
LVL 65

Expert Comment

by:Jim Horn
ID: 39988488
Correct.
0
 

Author Comment

by:donnie91910
ID: 39989054
This data is from an Oracle database.
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39989082
>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
 

Author Comment

by:donnie91910
ID: 39989135
I apologize.
0
 
LVL 23

Accepted Solution

by:
David earned 500 total points
ID: 39989238
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
 

Author Comment

by:donnie91910
ID: 39990446
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
 
LVL 37

Expert Comment

by:ValentinoV
ID: 39990750
It would help if you could let us know what the error says, and what Oracle provider you're using.
0
 

Author Comment

by:donnie91910
ID: 39993089
the Oracle version that is being used is 11.1.0 client.  See attached for error.
Concatinate-error.jpg
0
 
LVL 37

Expert Comment

by:ValentinoV
ID: 39993693
Can you paste your full query as well, according to the error there's something wrong with it.
0
 
LVL 22

Expert Comment

by:Steve Wales
ID: 40123585
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question