不懂!是这个吗??
inset 另一个表 (列1,列2) selec (列1,列2) from 表

解决方案 »

  1.   

    上面写错!
    inset 另一个表 (列1,列2) select (列1,列2) from 表
      

  2.   


    一定要在存儲過程中做到, 用vb.net代碼寫我也會
    假定
    step 1, 
         select POID,MaterialID,Qty,name 
         from po_detial where poID='AAAA'
    step 2
         if讀出來10條,
           我要將stock的表中與它相關的MaterialID的數量改寫
           還要寫入很多表.......
          因為有很多條件決定來寫入某些表,所以一個連合的UPDATE語句是不能做的本人程式寫了4年了, 請將這個問題想復雜一點
      

  3.   

    哦!是不是这样:
    根据表1与表2的编号相同,来将表2的列修改到表1的列:update 表1 set 列=A.列 from 表2 as A where 表1.编号=A.编号楼主的题目的意思不明确呀!
      

  4.   

    不好意思,初來CSDN你講的UPDATE確實可以做一些相關的更新但這不是我的意思我是想存儲過程中SQL能不能寫像OOP語言中一樣的語法
    例如:
       1.讀出一個表的記錄 
       2. Where not record.eof
             if itemqty>xxx then save to table1
             if itemqty<>xxx then save to table2
             if itemqty=xxx then save to table3 
         wend 
    大概是這個樣子.
    重點是sql能不能做倒循環????thanks
      

  5.   

    哦!
    可以用游标呀!
    例:
    declare  cursor_insert cursor for select c# from cs
    declare
    @i int
    open cursor_insert
    fetch cursor_insert into @i
    while @@fetch_status=0
    begin
      print @i
      fetch cursor_insert into @i
    end
    close cursor_insert
    deallocate cursor_insert
      

  6.   

    如果你的记录与表名有逻辑关系的话:select @变量=表名列 from 元数据表exec('select * from '+@变量)