how that happen SP sql server

前端 未结 5 721
长情又很酷
长情又很酷 2021-01-28 04:29

I get something weird. i ran this sql:

SELECT   Id , GameTypeId , PlayerId , BetAmount , Profit ,
         DateAndTime
FROM     Results
WHERE    DateAndTime >         


        
5条回答
  •  星月不相逢
    2021-01-28 05:06

    Because you're using variables for your values, the query optimizer doesn't know how selective your WHERE clause is, and decides to use a table scan. Try creating a clustered index on your DateAndTime field.

提交回复
热议问题