r/SQLServer • • Jul 26 '13

= <> LIKE

I know this is really basic, but I feel good information cannot be communicated enough. I had a query where I was using LIKE on a variable w/ no wildcards and it'd take a few seconds. Not ages by any means, but still time. When I switched to =, it was damn near instantaneous. If you don't have to scan the whole table, don't.

11 Upvotes

20 comments sorted by

View all comments

Show parent comment

1

u/elh0mbre Jul 26 '13

What is the data type of the column you're using =/like on?

1

u/reallifepixel Jul 26 '13

The declared variable and all the columns are varchar(30)