用select ... into ... from table

解决方案 »

  1.   

    select a,b,c,'1','sss'
    into #temp
    from table
      

  2.   

    declare @bb char(20)
    declare @cc char(20)
    select @bb=bb,@cc=cc from table2 where 条件
    go
    insert into table1(a,b,c) values('1',@bb,@cc)
    go
      

  3.   

    不行啊,我这条sql是往一个表中插入一条记录,有的字段是自己的赋值,有的字段是从别的表中选出来的,楼上的是将值放到变量里啊,等待
      

  4.   

    to chnking(kent)
    asp.net里面好想不能这样写的,你写的是个过程,不是一条语句啊,我也想这样处理过,但是.net对 oracle 的语句有限制,一次只能执行一条sql语句,要是sql语句能写成pl/sql形式那就很好办了,关注
      

  5.   

    insert into table1(a,b,c) 
    select '1',bb,cc from table2 where 条件)
      

  6.   

    上面多了个括号,呵呵
    insert into table1(a,b,c) 
    select '1',bb,cc from table2 where 条件
      

  7.   

    谢谢,知道了,我想再问一下基于事务的多sql什么写比较好,最好能详细一点,我已经发了帖子了
    http://expert.csdn.net/Expert/topic/2216/2216213.xml?temp=.9060175