title: Updating Values of a table from same table without using a select query
body: <p>My Requirement<br>
   Updating Values of a table from same table without using a select query
      this query won't effect any rows.
      My aim : <code>Update val2 of #table where slno=1 with the value of val2 of slno=2</code>
        Is there any other way without doing this method</p>
  
  <pre><code> Declare @val2 nvarchar(50)
    select @val2=val2  from #table where slno=2
    update #table set val2=@val2 where slno=1
  
  
      create table #table 
      (
       slno int identity(1,1),
       val nvarchar(50),
       val2 nvarchar(50)
      )
  
      insert into #table(val,val2)values('1',newID())
      insert into #table(val,val2)values('1',newID())
      insert into #table(val,val2)values('1',newID()) 
  
      select * from #table 
  
      update #table set val2=T.val2 
        from #table T where slno=1 and T.slno=2
  
  
  
        drop table #table
  </code></pre>
  
  <p>I have lot of records in the table.
  So If i am selecting and update it may effect the performance.</p>