To: CrazyFor(Fan) 
谢谢指教
请问是否sql server没有提供这样的能力
我以前在oracle中有用过数组

解决方案 »

  1.   

    用表变量吧!
    declare @aa table(aa int,bb int)
      

  2.   

    To pengdali(大力) 
    能否具体描述一下如何应用 表变量
    非常感谢
      

  3.   

    看了帮助,还是不大明白
    table_type_definition ::=
        TABLE ( { column_definition | table_constraint } [ ,...n ] ) column_definition ::=
        column_name scalar_data_type
        [ COLLATE collation_definition ]
        [ [ DEFAULT constant_expression ] | IDENTITY [ ( seed , increment ) ] ]
        [ ROWGUIDCOL ]
        [ column_constraint ] [ ...n ] column_constraint ::=
        { [ NULL | NOT NULL ]
        | [ PRIMARY KEY | UNIQUE ]
        | CHECK ( logical_expression )
        } table_constraint ::= 
        { { PRIMARY KEY | UNIQUE } ( column_name [ ,...n ] )
        | CHECK ( search_condition ) 
        } 请哪一位大虾给个例子研究一下,非常感谢
      

  4.   

    declare @变量名 table (列1 int,列2 int)
    insert @变量名 values (1,2)
    insert @变量名 values (3,4)
    insert @变量名 values (6,8)select * from @变量名
      

  5.   

    最好:但要知道结构
    declare @aa table (a int,b int)
    其次
    select * into #aa from table
    不建议:会写入硬盘
    select * into ##aa from table
      

  6.   

    你不用表变量,但你有10000..条记录你光select * from aa不加条件照样很慢,数据同样在内存中呀!!!
      

  7.   

    非常感谢 pengdali(大力) 的耐心帮助
    一点点分数略表感激之情:)