Does a '+' before the first column is ignored or has an impact?

Viewed 91

This is not really a problem but just want to not stay in ignorance if this operator may have an impact of a query.

To make it simple, I had a query like :

SELECT 'A', + 'B'

The expected result was 'AB'. But because of an unwanted comma before the ' + ', the result was two columns, 'A' and 'B'.

After found this, I'm wondering how SQL Server reads a query like

SELECT + 'A'

because it returns 'A'. Is this '+' ignored, or interpreted like '' + 'A', or there is in a particular situation an impact on the query ?

Thank you for your attention.

PS, just for fun, because here its easy to see the problem but my case was more :

SELECT CASE WHEN 1 = 1 THEN 'A' ELSE 'B' END, + CASE WHEN 1 = 1 THEN 'B' ELSE '' END AS MYFIELD

I put 1 = 1 to illustrate that I was sure about my conditions, and MYFIELD was returning 'B', just like, without the comma, the two conditions were wrong...

0 Answers
Related