sp_executesql causing my query to be very slow

前端 未结 1 952
遇见更好的自我
遇见更好的自我 2021-02-20 16:27

I am having some issues when running sp_executesql on a database table. I am using an ORM (NHibernate) that generates a SQL query that queries one table in this case. This tab

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-20 16:56

    what is the data type of .[Context] use the same datatype

    right now you are using nvarchar(2) but that seems odd for something like 55, if you are not using the same data types you will get conversions which then cause scans

    based on your updated question, it looks like it is varchar(255), then do this

    WHERE this_.[Context] = @p0',N'@p0 varchar(255)',@p0='55'
    

    0 讨论(0)
提交回复
热议问题