Friday, January 21, 2011

Table Variable-The Deletion

Here is the creation of a "Table Variable" table, the inserting of 3 records, and the deletion of one of those records.

  DECLARE @varTable table(  
  Id int IDENTITY(1,1),  
  UserName VARCHAR(25),  
  Passwd VARCHAR(15)  
  )  
    
  INSERT into @varTable(UserName,Passwd)  
  Values('Jib','JibsPasswd')  
    
  INSERT into @varTable(UserName,Passwd)  
  Values('Jax','JaxsPasswd')  
    
  INSERT into @varTable(UserName,Passwd)  
  Values('Who','WhosPasswd')  
    
  SELECT *   
  From @varTable 

  DELETE From @varTable  
  Where id=1  
    
  SELECT *   
  From @varTable  

  GO   

More to Come, CA.

No comments:

Post a Comment