问题描述:
最近给学校在做一个.NET网站,名字叫做文正学院过程化成绩录入系统,其中需要用到老用户登陆系统需要从旧系统里将以前存在的数据导入到新数据表中,
USE [new_wzjw] GO /****** Object: StoredProcedure [dbo].[成绩管理_过程化成绩录入_数据迁移] Script Date: 2014/3/16 22:55:38 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[成绩管理_过程化成绩录入_数据迁移] @kcId jxrw_code/*自定义变量名*/ as begin begin try begin tran INSERT 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 tran return 0 end try begin catch rollback tran return 1 end catch end