SQL Server:表变量的声明和赋值

  1. DECLARE @tempTable TABLE (strVal int);   
  2.   
  3. INSERT INTO @tempTable    
  4. SELECT * FROM EXAMPLE_TABLE; --与@tempTable表结构一致 ,如果不一致要写上字段名
  5.   
  6. SELECT * FROM @tempTable;  
posted @ 2010-03-09 11:20  anny0320  阅读(3033)  评论(0)    收藏  举报