select column_xxx  into tabel_xxxx
column_xxx  肯定是要通过select  from等语句查出来的,只是写法上我这么写提示  into那有错误,请问该这么写

解决方案 »

  1.   


    USE AdventureWorks;
    GO
    SELECT c.FirstName, c.LastName, e.Title, a.AddressLine1, a.City, sp.Name AS [State/Province], a.PostalCode
    INTO dbo.EmployeeAddresses
    FROM Person.Contact AS c
    JOIN HumanResources.Employee AS e ON e.ContactID = c.ContactID
    JOIN HumanResources.EmployeeAddress AS ea ON ea.EmployeeID = e.EmployeeID
    JOIN Person.Address AS a on a.AddressID = ea.AddressID
    JOIN Person.StateProvince as sp ON sp.StateProvinceID = a.StateProvinceID;
    GO还是把你的SQL语句贴出来看看吧
      

  2.   

    select column_xxx into tabel_xxxx --这个表是不存在的,否则会报错
    from tb--这个表是现有的
    where 1<1--加上这个条件只复制表结构,不复制数据
      

  3.   

    恩,是这意思,问题是我用原来的语句可以查询出数据,但把select into一加进去就报错,Msg 1038, Level 15, State 5, Line 4
    缺少对象或列名,或者对象或列名为空。对于 SELECT INTO 语句,请确保每列均具有名称。对于其他语句,请查找空的别名。不允许使用定义为 "" 或 [] 的别名。请添加名称或单个空格作为别名。 
    这个是什么意思,我的所有列 没有空的别名,只是有的列没有定义别名,难道这也是错
      

  4.   

    我觉得这个说得比较清楚了,你可能是没有后面的from tb吧?
    select column_xxx into table_xxx本身就是错误的。