1

I am using SQL Server 2008 r2 and facing a problem while executing a select command. Please look into the structure of my table(all column's datatype is nvarchar) :

employee  id      fname   lname
--------------------------------
abcdef    12345   Amit    Sharma
abcdeg    12346   Amit    Shar

when I try to query out with following command

select * 
from userinfo 
where employee = 'abcdef   ' and id = '12345    '

It still gives me the result back.

I am not able to identify the problem.

Please suggest me anything that I can do to fix this.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Amit Sharma
  • 1,202
  • 11
  • 26

1 Answers1

2

You have a valid point but it is according to SQL Standard you can read this link to find out what is the difference in = and LIKE,also following answer on SO from Milan Babuškov Hope it helps

Community
  • 1
  • 1
NetStarter
  • 3,189
  • 7
  • 37
  • 48