sybase update ,insert

来源:互联网 发布:matlab 定义三维数组 编辑:程序博客网 时间:2024/06/05 09:37

学习学习:

 

sybase 根据字段值改多条记录

 

update A  set
a.bbv=(case a.bby

                                            when '1'  then '100' 

                                            when '2'  then '200' 

                                            when '3'  then '300'
                                                    end),
                     
               a.bbc=(case a.bby

                                               when '1'  then 'a'
                                               when '2'  then 'b'
                                               when '3'  then 'c'
                                             end),
                                               
              a.bbf=(case a.bby

                                              when '1'  then 'e'
                                               when '2'  then 'd'
                                               when '3'  then 'f'
                                          end)


             from A a

 

意思是,A表有 bby,bbv,bbc,bbf 四个字段,当bby = 1时,其余三个值为别改为:100,a,e

 

 

 

 

 

   insert   union 连用的写法

 

   insert into A 

           select '1','2','3','4'
   union all 

           select '5','6','7','8'
   union all
           select '9','10','11','12'

 

    完成一次插入多条数据