如题,我通过 select * from DB 查询出一条或几条记录,想保存到另一个表 DT,该如何做?表结构和查询语句一致。

解决方案 »

  1.   

    insert into DT select * from DB Where 条件
      

  2.   

    谢谢楼上的。可是,还有个问题:在DT中还有一列InsertTime,是记录保存时间用的,又该如何处理?在查询分析器里,提示:列名或所提供值的数目与表定义不匹配。
      

  3.   

    insert into DT select * from DB Where 条件中不得到Time,可以通过数据库的函数直接插入保存时间吧.我就是这么做的.SQL 2000,getdate().
      

  4.   

    谢谢,能不能用参数?类似 @time
      

  5.   

    insert into DT select *,  @time from DB Where 
    ...cmdSelect.SelectCommand.Parameters.Add(New SqlParameter("@time", "2001-1-1"))
      

  6.   

    insert into DT select * ,GetDate() from DB where 条件这样就可以了