不用存储过程,不用insert,光用一个select语句怎样往一个表A里的B字段添加N条值为C的记录?
即使得结果为:
A: B   C
   C
   C
.....

解决方案 »

  1.   

    insert A(B)select top N
    'C'
    from 
    sysobjects a
      

  2.   

    INSERT 插入.
    SELECT 查询
      

  3.   

    記錄多時
    select 
    top N
    'C'
    from 
    syscolumns a
    ,
    syscolumns b
    --這樣連多幾個表
      

  4.   

    我是要要从另外一个表里查询出C,然后在表A里重复N次,不能用insert,请问该怎么写?谢谢上面各位
      

  5.   

    我明白了,你想用  select * into a from C 这种语句。这样有啥意义呢,用insert语句有啥不好的
      

  6.   

    因为想用语句返回数据集,用select 就可以返回,而insert就要多个语句,而权限不能用存储过程
      

  7.   

    select c into A.b from B
      

  8.   

    楼主的意思是因为权限制约,想用SELECT语句往表里加数据??做不到的..
      

  9.   


    declare @n int
    set @n=100
    while @n>0
    begin
      insert A(B) select c from tb
      set @n=@n-1
    end
      

  10.   

    不用insert,添加记录???
    学习