Solved

Concatination

Posted on 2014-04-08
14
114 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
 
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now