Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text strings concatenation “&” or “+”

Status
Not open for further replies.

PWise

Programmer
Dec 12, 2002
2,633
US
Text strings concatenation “&” or “+”
What is the difference what you use for text strings concatenation “&” or “+”?
 
NOrmally you use & in VBA code but in T-SQL you use the + sign
 
Thanks everyone
randysmid:
Following your lead for the + operator and from there to the & operator
I see that the difference is that with the + operator if one value is null the result is null
“Hello” + null + “ everyone” = null
but with the & operator the result is the rest of the string
“Hello” & null & “ everyone” = “Hello everyone”
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top