Select “where clause” evaluation order

前端 未结 7 1586
梦毁少年i
梦毁少年i 2020-12-06 09:40

In Sql Server 2005 when I have multiple parameters do I have the guarantee that the evaluation order will always be from left to right?

Using an exa

7条回答
  •  鱼传尺愫
    2020-12-06 10:06

    SQL Server will generate an optimized plan for each statement it executes. You don't have to order your where clause to get that benefit. The only garuntee you have is that it will run statements in order so:

    SELECT A FROM B WHERE C
    SELECT D FROM E WHERE F
    

    will run the first line before the second.

提交回复
热议问题