title: Why would SqlServer select statement select rows which match and rows which match and have trailing spaces
body: <p>I have a table created with:</p>
  
  <pre><code>SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  SET ANSI_PADDING ON
  GO
  CREATE TABLE [dbo].[TestFeature1](
  [Id] [nvarchar](50) NOT NULL,
  [Leng] [decimal](18, 0) NOT NULL
  ) ON [PRIMARY]
  
  GO
  SET ANSI_PADDING OFF
  </code></pre>
  
  <p>I inserted data with this:</p>
  
  <pre><code>insert into TestFeature1 (id,leng) values ('1',100);
  insert into TestFeature1 (id,leng) values ('1 ',1000);
  </code></pre>
  
  <p>When I select from the table with this:</p>
  
  <pre><code>select * from TestFeature1 where id='1';
  </code></pre>
  
  <p>this returns 2 rows</p>
  
  <pre><code>1   100
  1   1000
  </code></pre>
  
  <p>why would this be?  why is it returning the version with the space on the end even when the query specifies that the value is only a 1 on its own, with no space?</p>