SQL編程:預存程序+交易處理+復原+資料移轉

來源:互聯網
上載者:User

問題描述:

最近給學校在做一個.NET網站,名字叫做文正學院過程化成績錄入系統,其中需要用到老使用者登陸系統需要從舊系統裡將以前存在的資料匯入到新資料表中,


USE [new_wzjw]GO/****** Object:  StoredProcedure [dbo].[成績管理_過程化成績錄入_資料移轉]    Script Date: 2014/3/16 22:55:38 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOcreate proc [dbo].[成績管理_過程化成績錄入_資料移轉]  @kcId jxrw_code/*自訂變數名*/asbeginbegin trybegin tranINSERT INTO [web_inputCj_xsxkb]([xh] ,[xm],[xxxzdm],[xxxzmc],[cjxzdm],[kcid],[lrsj],[manuAdd]) select xh, xm, xxxzdm,xxxzmc, cjxzdm, kcid, lrsj, manualAdd from web_inputCj_cjb as a where a.kcId = @kcId and not exists ( select * from web_inputCj_xsxkb as b where a.xh = b.xh and a.kcId = b.kcid )commit tranreturn 0end trybegin catchrollback tranreturn 1end catchend

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.