资源描述:
《中国石油大学华东数据库实验六龚安》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验六其它数据库对象的管理1.begintransactioninsertintoxiangmubiaovalues('zy2011006','112202002','y005',10000,'张三','07-01-2011','07-04-2011','07-25-2011','作业公司作业一队','堵漏',7000,2500,1000,1400,11900,'李四','07-26-2011',11900,'王五','07-28-2011');insertintocailiaofeibiaovalues('zy2011006','wm001',200,10);insertin
2、tocailiaofeibiaovalues('zy20110006','wm002',200,10);insertintocailiaofeibiaovalues('zy20110006','wm003',200,10);insertintocailiaofeibiaovalues('zy20110006','wm004',200,10);rollbackbegintransactiongoinsertintoxiangmubiaovalues('zy2011006','112202002','y005',10000,'张三','07-01-2011','07-04-2011
3、','07-25-2011','作业公司作业一队','堵漏',7000,2500,1000,1400,11900,'李四','07-26-2011',11900,'王五','07-28-2011');if@@error<>0beginprint'第一个插入出错'rollbackendelsebeginprint'第一个插入成功'commitendgobegintransaction;begintryinsertintocailiaofeibiaovalues('zy2011006','wm001',200,10);print'第二个插入成功'commitendtrybeginc
4、atchprint'错误';if@@TRANCOUNT>0rollbacktransaction;endcatchif@@trancount>0committransaction;gobegintransactiongoinsertintocailiaofeibiaovalues('zy20110006','wm002',200,10)if@@error<>0beginprint'第三个插入出错'rollbackendelsebeginprint'第三个插入成功'commitendgobegintransactiongoinsertintocailiaofeibiaovalue
5、s('zy20110006','wm003',200,10)if@@error<>0beginprint'第四个插入出错'rollbackendelsebeginprint'第四个插入成功'commitendgobegintransactiongoinsertintocailiaofeibiaovalues('zy20110006','wm004',200,10)if@@error<>0beginprint'第五个插入出错'rollbackendelsebeginprint'第五个插入成功'commitendGo2.begintransactionDECLARECustomer
6、CursorscrollCURSORFORselect*fromxiangmubiao;OPENCustomerCursor;declare@zuoyexiangmubianhaochar(12)declare@yusuandanweichar(13)declare@jinghaochar(5)declare@yusuanjinechar(10)declare@yusuanrenchar(6)declare@yusuanriqichar(10)declare@kaigongriqichar(10)declare@wangongriqichar(10)declare@shigon
7、gdanweimingchengchar(10)declare@shigongneirongchar(8)declare@cailiaofeichar(10)declare@rengongfeichar(10)declare@shebeifeichar(10)declare@qitafeiyongchar(10)declare@jiesuanjinechar(10)declare@jiesuanrenchar(6)declare@jiesuanriqichar(10)declare@ruzh