以下这条SQL语句是什么意思啊?#cg_temp 这个表的有效时间是多长?我重新登录一下,这个表就不能用了。
select xid=identity(int,1,1), ccomunitname into #cg_temp from po_pomain 

解决方案 »

  1.   

    ?#cg_temp 
    这个是局部变量
    也可以说是一个临时表,并没有真正加到数据中,页面一关闭就没了
      

  2.   

    向#cg_temp这个临时表中插入po_pomain这个表的ccomunitname字段的值,并且给了个自增长列Xid
    select xid=identity(int,1,1), ccomunitname into #cg_temp from po_pomain 
    比如po_pomain这个表的ccomunitname字段值是
    ccomunitname
    123
    6161
    16130
    7841
    2984那么 #cg_temp表中就是
    xid  ccomunitname
    1      123
    2      6161
    3      16130
    4      7841
    5      2984
      

  3.   

    select xid=identity(int,1,1), ccomunitname into #cg_temp from po_pomain 
    从po_pomain 中取ccomunitname 插入表#cg_temp中,#cg_temp表有两列