Exec('Select * into '+@newTable + ' from oldTable ')

解决方案 »

  1.   

    declare @newtable varchar(20)
    exec('select * into '+@newtable+' from tablename')
    go
      

  2.   

    按照上述编的程序,执行时出错,请予指点。程序如下:<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
    <!--#include file="conn.asp"-->
    <%
    '复制数据表结构
    Dim newTable
    newTable=111
    Const adCmdText=1
    set comm=server.createobject("adodb.command")
    comm.ActiveConnection=conn
    comm.CommandText="'select *  into '+@newTable+' from RationInfo'"
    comm.CommandType=adCmdText
    comm.execute
    %>
      

  3.   

    comm.CommandText="'select *  into '+newTable+' from RationInfo'"
      

  4.   

    comm.CommandText="select *  into "+newTable+" from RationInfo"
      

  5.   

    comm.CommandText="select *  into " & newTable & " from RationInfo"