《SQL的存储过程语句,查询插入删除修改语句.docx》由会员分享,可在线阅读,更多相关《SQL的存储过程语句,查询插入删除修改语句.docx(2页珍藏版)》请在三一办公上搜索。
1、SQL的存储过程语句,查询插入删除修改语句2、创建存储过程 Custom表: CREATEPROCEDUREcustomshow as SELECTcid=id,ccname=cname,cdepartID=departID,cage=age,cename=ename,cpassword=password fromcustom CREATEPROCEDUREcustomquery(cidint) as SELECTid,cname,departID,age,ename,password fromcustom whereid=cid CREATEPROCEDUREcustominsert(cid
2、int,ccnamenvarchar(50),cdepartIDint,cageint,cenamenvarchar(50),cpasswordnvarchar(50) as INSERTintocustomVALUES(cid,ccname,cdepartID,cage,cename,cpassword) CREATEPROCEDUREcustomdelete(cidint) as DELETEFROMcustom whereid=cid CREATEPROCEDUREcustomupdate(cidint,ccnamenvarchar(50),cdepartIDint,cageint,ce
3、namenvarchar(50),cpasswordnvarchar(50) as UPDATEcustom SETcname=ccname,departID=cdepartID,age=cage,ename=cename,password=cpassword where id=cid CREATEPROCEDUREdepartmentshow as SELECTid,departname,description fromdepartment CREATEPROCEDUREdepartmentquery(didint) as SELECTid,departname,description fr
4、omdepartment whereid=did CREATEPROCEDUREdepartmentinsert(didint,ddepartnamenvarchar(50),ddescriptionnchar(10) as INSERTintodepartmentVALUES(did,ddepartname,ddescription) CREATEPROCEDUREdepartmentdelete(didint) as DELETEFROMdepartment whereid=did CREATEPROCEDUREdepartmentupdate(didint,ddepartnamenvarchar(50),ddescriptionnchar(10) as UPDATEdepartment SETid=did,departname=ddepartname,description=ddescription