create table #mayong as (select distinct* from dbo.Customers)报错:消息 156,级别 15,状态 1,第 1 行
关键字 'as' 附近有语法错误。
就这么一句,SQl就是报错,错啊了?是网上的代码啊?

解决方案 »

  1.   

    select distinct * into #mayong from dbo.Customers
      

  2.   

    select distinct * INTO #mayong from dbo.Customers
      

  3.   

    难道create table #mayong as 是错的???不可能吧,网上教程上写的
      

  4.   

    (1)通过建立临时表来实现 SQL>create table temp_emp as (select distinct * from employee)  SQL> truncate table employee; (清空employee表的数据) SQL> insert into employee select * from temp_emp;  (再将临时表里的内容插回来)
    出自:http://www.pconline.com.cn/pcjob/other/data/others/0508/693592_1.html
      

  5.   

    select * into  #mayong  from  (select distinct * from dbo.Customers) a
      

  6.   

    select distinct *  into #mayong from dbo.Customers
      

  7.   

    这个不会是SQL
    MSSQL没有这个语法。
      

  8.   

    那是mysql
    不是t-sql
    语法上有差异