id name price
1  A     100
2  B     200
3  C     300
上面是我获取的记录集,然后我想调用里面的字段price,乘一个固定值,然后将所有数据插入另外一个表

id  int
name var(10)
index int  -- 行数
oldprice    --旧的 
newprice    --新的能不能insert into 表 values (...)做循环添加进去呢?

解决方案 »

  1.   


    select id,name,price,price*0.2 into newtable from tb
      

  2.   

    insert into 表2
     select id,name,row_number(order by getdate()),price,price*固定值 from 表1
      

  3.   

    insert into 表  select ID,name,@@ROWCOUNT,price,price*2 from table1 
      

  4.   

    insert into 表 select id, name ,index 是什么意思? , price oldprice , price*乘一个固定值 newprice from 原来的表