三种方法:增加一个自动增长的列

--eg1:表里增加字段
CREATE TABLE t7(id int IDENTITY(100,1));

--eg2:
--自动增长的函数
 create   function   iden()   
  returns   int   
  as   
  begin   
      declare   @a1   int   
      set   @a1   =   1   
      while   exists(select   *   from   table_name   where   id=@a1)   
          set   @a1   =   @a1   +   1   
      return   @a1   
  end 

--eg3: 虚拟表
select   identity(int,1,1)   kk,*   into   #t   from   T 
select   #t
<style type="text/css">.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } </style>

你可能感兴趣的:(html,css,asp)