0

I am trying to fetch data using composite primary key. I am sending 2 strings as query parameters, but SQL Server execution plan shows query parameters @p0 nvarchar(4000) & @p1 nvarchar(4000) and it is using index scan instead of index seek. Why?

How come I see varchar size 4000, my column type is varchar 30 & 255 respectively?

How to force my execution plan to use index seek?

Thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • The SQL Server query optimizer will pick **what is best** for your current query. So maybe in your case here, doing a **scan** is ultimately cheaper and costs less processing time and less memory than doing a seek. A seek isn't always just better! How does your table look like? What columns do you have? What data (how many rows etc.) is stored inside that table? What's the query? – marc_s Apr 07 '14 at 16:25
  • Please show us your **table structure** and the **query** you're talking about! We can neither read your screen, nor your mind ... – marc_s Apr 07 '14 at 16:30

0 Answers0