Solved

Concatination

Posted on 2014-04-08
14
116 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
  • 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
case statement in where clause 5 48
Chrome SSRS print Functionality 1 46
Create table from select - oracle 6 38
ORA-00923: FROM keyword not found where expected 3 60
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
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.

775 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