你的位置:首页 > 软件开发 > 数据库 > 循环,批量插入数据(日期值)

循环,批量插入数据(日期值)

发布时间:2016-08-29 10:00:04
Create proc setup_list_add@creatime Datetime--创建时间,@objjc Varchar(20)--排期项目,@Doctor Varchar(20)--接诊医生,@beginDate Datetime--排班开始,@endtDate Da ...
Create proc setup_list_add@creatime Datetime--创建时间,@objjc Varchar(20)--排期项目,@Doctor Varchar(20)--接诊医生,@beginDate Datetime--排班开始,@endtDate Datetime--排班结束,@objuser Varchar(20)--排班人asbeginbegin transaction T1Declare @n Datetimeset @n=@beginDatewhile @n<=@endtDatebegin insert into Scheduling_setup(creatime,objjc,Doctor,begintime,endtime,objuser) select @creatime,@objjc,@Doctor,CONVERT(char(16), @n+begintime,120),endtime,@objuser from times_setup where objjc=@objjcset @n=dateadd(dd,1,@n)endIF @@ERROR <> 0 GOTO FINALROLL select '添加成功!' msg,1 codeCOMMIT TRAN T1RETURNFINALROLL:  select '添加失败' msg,2 codeROLLBACK TRAN T1endGo

原标题:循环,批量插入数据(日期值)

关键词:日期

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。