Amit Sharma
Amit Sharma

Reputation: 1210

extra space in sql where condition issue

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.

Upvotes: 1

Views: 272

Answers (1)

NetStarter
NetStarter

Reputation: 3225

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

Upvotes: 2

Related Questions