SQL Server’s T-SQL syntax seems to allow multiple plus signs in succession:
SELECT 1 + 2 --3
SELECT 1 ++ 2 --3
SELECT 1 ++++++ 2 --3
SELECT 1 + '2' --3
SELECT 1 ++ '2' --3
SELECT '1' + '2' --'12'
SELECT '1' ++ '2' --'12'
Multiple pluses seem to behave just like a single plus. Why does the “multiple plus operator” ++ exist? What does it do?
The first plus sign is interpreted as an addition operator. Each of the remaining plus signs is interpreted as a unary plus operator:
It’s very common in programming languages to have this unary plus operator, though it’s rarely used in SQL as it doesn’t actually do anything.
The unary plus operator is mentioned in the SQL-92 standard.
While unary plus isn’t all that useful, it has a more useful companion: unary minus. It is also known as the negative operator.