SQL Server 2008 Query Editor changes the query logic?

I tried to replicate this in the Query Designer and had a slightly different result. I typed the same as you: SELECT * FROM Tab1 WHERE A='1' AND (B='1' OR C='1') And got this: SELECT * FROM Tab1 WHERE (A = '1') AND (B = '1') OR (A = '1') AND (C = '1') I have to say that the result is the same, but we can all see a dangerous road here. Also, I did not like the (A = '1') replication.

Heck, I want the code how I coded it! A word to the wise: I never format my queries in SQL Server Management Studio. Have you seen what it does to your view's code?

I hate it. I just code somewhere else and paste in SMS when done.

I tried to replicate this in the Query Designer and had a slightly different result. I typed the same as you: SELECT * FROM Tab1 WHERE A='1' AND (B='1' OR C='1'); And got this: SELECT * FROM Tab1 WHERE (A = '1') AND (B = '1') OR (A = '1') AND (C = '1') I have to say that the result is the same, but we can all see a dangerous road here. Also, I did not like the (A = '1') replication.

Heck, I want the code how I coded it! A word to the wise: I never format my queries in SQL Server Management Studio. Have you seen what it does to your view's code?

I hate it. I just code somewhere else and paste in SMS when done.

Yes, both Adrian and MicSim are correct. I think I jumped the guns a little with panic, BECAUSE of the new duplicated condition with my brackets messed around as you pointed out. Will be wary of it though.

– Sivakanesh Jun 28 at 15:39.

The statement SELECT * FROM Tab1 WHERE A='1' AND (B='1' OR C='1') resolves for me to: SELECT * FROM Tab1 WHERE (A='1') AND (B='1') OR (A='1') AND (C='1') This is surprisingly correct, as in SQL Server TSQL the AND operator has precedence over OR. That means the above is the same like the following, because the AND-operator gets evaluated before the OR-operator: SELECT * FROM Tab1 WHERE ((A='1') AND (B='1')) OR ((A='1') AND (C='1')) And this is the same like the initial statement being used in the question. See Operator Precedence (Transact-SQL) for details.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions