Inserting Rows Using SELECT INTO
The SELECT INTO statement creates a new table and populates it with the result set of the SELECT. The structure of the new table is defined by the attributes of the expressions in the select list, for example:SELECT Shippers.*, Link.Address, Link.City,
                   Link.Region, Link.PostalCode
INTO NewShippers
FROM Shippers
     JOIN LinkServer.DB.dbo.Shippers AS Link
       ON (Shippers.ShipperID = Link.ShipperID)SELECT INTO can be used to combine data from several tables or views into one table. It can also be used to create a new table containing data selected from a linked server.

解决方案 »

  1.   

    SELECT A.FIELD FROM A INTO TABLE B
      

  2.   

    EXEC SQL SELECT au_lname INTO :name FROM authors WHERE stor_id=:id;SELECT [select_list] INTO {:hvar [,...]} select_optionsSELECT Shippers.*, Link.Address, Link.City,
                       Link.Region, Link.PostalCode
    INTO NewShippers
    FROM Shippers
         JOIN LinkServer.DB.dbo.Shippers AS Link
           ON (Shippers.ShipperID = Link.ShipperID)