问题1:
请教:
       数据库为 SQL SERVER 2000
       我要循环向 表:table1 出入同一条记录       insert table1(sno,name)
       vaules ('0001','ddd')可是我要插入 1000 条在 查询分析器里怎么实现啊?谢谢!
问题2:
当我手工修改数据库的一条记录
就出现如附件所示的错误:
key column information is  insufficient or incorrect .too many rows were 
affected by update各位大大这是什么原因啊?谢谢!

解决方案 »

  1.   

    第1个问题
    declare @id int,@nub int
    set @id=0
    set @nub=10000
    while @id<@nub
    begin
    insert table1(sno,name)  vaules ('0001','ddd')
    set @id=@id+1
    end
      

  2.   

    谢谢  hqhhh 大哥和  hhzqf1980 大哥!
      

  3.   

    insert table1(sno,name) select field1,field2 from table2
      

  4.   

    1、
    declare @i int
    select @i = 1
    while @i <= 1000
    begin
      insert table1(sno,name)
           vaules ('0001','ddd')
      select @i = @i +1
    end
    go2、你的表中没有定义主键(或唯一索引),当修改某一条数据时,根据键值找到的是多条记录,如果强行修改就将影响多条数据而不是你要修改的那一条。
    如果实在找不到唯一键,可以新建一个字段来做唯一标识符。