OU Opérateur court-circuit dans SQL Server

Je veux consulter SQL Server OU de court-circuit

Code:

   DECLARE @tempTable table
      (
         id int
      )
      INSERT @tempTable(id) values(1)

      DECLARE @id varchar(10)
      SET @id = 'x'
      SELECT * FROM @tempTable WHERE 1=1 OR id = @id --successfully
      SELECT * FROM @tempTable WHERE @id = 'x' OR id = @id --Exception not Convert 'x' to int

Pourquoi? 1=1 et @id='x' est vrai.

SQL Server OU de l'opérateur : si le court-circuit de la fonction?

GRÂCE

source d'informationauteur NotTwoWayStreet | 2012-06-27