I am working on SSRS Report.
I have one question, what is the difference between +
and &
in ssrs-expression?
Please share your answer with short example. Thanks.
Actually its depends on how you are going to use them.
1.) For Concatenation purpose
According to MSDN:
&
and +
for concatenation will result to the same behaviour or output. It will only concatenates two strings.Example:
= 1 & 2
Output: 12
= "1" + "2"
Output: 12
2.) For Arithmetic purpose
+
for arithmetic purpose will add the two numbers togetherExample:
= 1 + 2 //(using two numbers)
Output: 3
= 1 + "2" //(using a number and a number with quotes)
Output: 3
------------------------------------------------------------------------
Exceptions
Now there are exceptions that an integer and a string is mixed up or with other types
Example:
= 1 + "two"
Output: #Error
-> this is because they are incompatible with each other.
Example:
= CSTR(1) + "two"
Output: 1two
There are other more conversion functions which you can use depending on your needs.