I have recently run across t-sql queries that use the LIKE keyword without a wild card, e.g. select * from SomeTable WHERE SomeColumn LIKE 'someValue' Is there any valid reason for doing this? Does this behave differently from simply using equal?
There are differences, actually. In the specific example you give, I can't see a reason why there would be any difference from using an equals operator, and that would be faster. But the SQL below demonstrates an example of LIKE and = returning different results. CREATE TABLE #temp (nam [varchar](MAX)) INSERT INTO [#temp] ([nam]) VALUES ('hello') INSERT INTO [#temp] ([nam]) VALUES ('hello ') SELECT * FROM #temp WHERE [nam] = 'hello ' SELECT * FROM #temp WHERE [nam] LIKE 'hello ' The first result set returns two rows, because = will ignore trailing spaces, whereas the second result set returns one row, because all characters in the LIKE pattern are important. From [LIKE (Transact-SQL)] on MSDN: > When you perform string comparisons by using LIKE, all characters in the pattern string are significant. This includes leading or trailing spaces. :