title: Linq MVC5 MSQL select some columns from a table containing larg amount of columns in order to make better and fast query
body: <p>For example a table that is containing like 30 columns</p>
  <pre><code>table1{col1,col2,col3,col4,col5,col6....,col30}
  </code></pre>
  <p>here we can do like</p>
  <pre><code>        List&lt;table1&gt; result = (from a in dbconn.table1.AsEnumerable()
  
                                          select new table1
                                          {
                                              col1= a.col1,
                                              col2= a.col2
                                          }).ToList();
          return result.ToList();
  </code></pre>
  <p>same as</p>
  <pre><code> SELECT 
  [Extent1].[col1] AS [col1], 
  [Extent1].[col2] AS [col2],
  [Extent1].[col3] AS [col3], 
  ....
  ....
  ....
  [Extent1].[col30] AS [col30], 
  FROM [dbo].[table1] AS [Extent1]
  </code></pre>
  <p>-&gt; almost 2 minutes</p>
  <p>but this is not correct because while doing this i am checking the result in <strong>SQL Server Profiler</strong>  the result of this linq query is getting all the table <em><strong>table1</strong></em> data then dumping to new table1 which is time consuming.</p>
  <p>now this makes the query very slow because larg amount of data is there so in sql we can just</p>
  <pre><code>select col1,col2 from table1 
  </code></pre>
  <p>-&gt; almost 2 seconds</p>
  <p>how can we do it in linq with out getting the full table and make the linq same or near to SQL.</p>