没有合适的资源?快使用搜索试试~ 我知道了~
SQL 存储过程学习总结.docx
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 126 浏览量
2022-07-07
14:02:36
上传
评论
收藏 149KB DOCX 举报
温馨提示
试读
12页
SQL 存储过程学习总结
资源推荐
资源详情
资源评论
integrated levy nephropathy integrated levy no symptoms urine check exception IgA nephropathy Lupus sex nephritis allergy sex Purpura sex nephritis diabetes nephropathy urinary tract infection kidney small tube between quality sex disease acute kidney failure chronic kidney failure requirements at least 30 cases 3. high requirements (1) learning disease species: radical sex nephritis. (2) language, and teaching, and research, capacity of requirements: abroad about literature reviewed or reading report 1 article (3) clinical knowledge, and skills requirements: kidney puncture (six) endocrine metabolism section 2 months (containing endocrine section outpatient 2 week) 1. Rotary purpose master: thyroid function hyperthyroidism syndrome and thyroid function decrease syndrome of causes learn, and clinical performance, and treatment and the laboratory performance; diabetes classification, and causes, and diagnosis standard, and clinical
select * from 成绩表
select * from 学生信息表
1 存储过程的定义
存储过程(procedure)类似于C语言中的函数
用来执行管理任务或应用复杂的业务规则
存储过程可以带参数,也可以返回结果
存储过程可以包含数据操纵语句、变量、逻辑 控制语句等
2 存储过程的优点
执行速度更快
允许模块化程序设计
提高系统安全性
减少网络流通量
int sum(int a,int b)
{
int s;
s =a+b;
return s ;
}
存储过程相
当于 C 语言
中的函数
存储过程
--------
--------
--------
单个 SELECT 语句
SELECT 语句块
SELECT 语句与逻辑
控制语句
可以包含
integrated levy nephropathy integrated levy no symptoms urine check exception IgA nephropathy Lupus sex nephritis allergy sex Purpura sex nephritis diabetes nephropathy urinary tract infection kidney small tube between quality sex disease acute kidney failure chronic kidney failure requirements at least 30 cases 3. high requirements (1) learning disease species: radical sex nephritis. (2) language, and teaching, and research, capacity of requirements: abroad about literature reviewed or reading report 1 article (3) clinical knowledge, and skills requirements: kidney puncture (six) endocrine metabolism section 2 months (containing endocrine section outpatient 2 week) 1. Rotary purpose master: thyroid function hyperthyroidism syndrome and thyroid function decrease syndrome of causes learn, and clinical performance, and treatment and the laboratory performance; diabetes classification, and causes, and diagnosis standard, and clinical
3、存储过程的分类
3.1 系统存储过程
由系统定义,存放在master数据库中
类似C语言中的系统函数
系统存储过程的名称都以“sp_”开头或”xp_”开头
3.2 用户自定义存储过程
由用户在自己的数据库中创建的存储过程
类似C语言中的用户自定义函数
4、常用的系统存储过程
4.1 系统存储过程列表
系统存储过程
说明
sp_databases
列出服务器上的所有数据库。
sp_helpdb
报告有关指定数据库或所有数据库的信息
sp_renamedb
更改数据库的名称
sp_tables
返回当前环境下可查询的对象的列表
sp_columns
回某个表列的信息
sp_help
查看某个表的所有信息
sp_helpconstraint
查看某个表的约束
sp_helpindex
查看某个表的索引
sp_stored_procedures
列出当前环境中的所有存储过程。
sp_password
添加或修改登录帐户的密码。
sp_helptext
显示默认值、未加密的存储过程、用户定义的存储过程、触
发器或视图的实际文本。
4.2 调用常用的系统存储过程
EXEC sp_databases --列出当前系统中的数据库
EXEC sp_renamedb 'Northwind','Northwind1' --修改数据库的名称(单用户访问)
USE stuDB --当前数据库中查询的对象的列表
GO
EXEC sp_tables --返回某个表列的信息
integrated levy nephropathy integrated levy no symptoms urine check exception IgA nephropathy Lupus sex nephritis allergy sex Purpura sex nephritis diabetes nephropathy urinary tract infection kidney small tube between quality sex disease acute kidney failure chronic kidney failure requirements at least 30 cases 3. high requirements (1) learning disease species: radical sex nephritis. (2) language, and teaching, and research, capacity of requirements: abroad about literature reviewed or reading report 1 article (3) clinical knowledge, and skills requirements: kidney puncture (six) endocrine metabolism section 2 months (containing endocrine section outpatient 2 week) 1. Rotary purpose master: thyroid function hyperthyroidism syndrome and thyroid function decrease syndrome of causes learn, and clinical performance, and treatment and the laboratory performance; diabetes classification, and causes, and diagnosis standard, and clinical
EXEC sp_columns stuInfo --返回某个表列的信息
EXEC sp_help stuInfo --查看表stuInfo的信息
EXEC sp_helpconstraint stuInfo --查看表 stuInfo 的约束
EXEC sp_helpindex stuMarks --查看表 stuMarks 的索引
EXEC sp_helptext 'view_stuInfo_stuMarks' --查看视图的语句文本
EXEC sp_stored_procedures --查看当前数据库中的存储过程
4.3 调用常用的扩展存储过程:xp_cmdshell
可以执行DOS命令下的一些的操作,以文本行方式返回任何输出
调用语法:
EXEC xp_cmdshell DOS命令[NO_OUTPUT]
【案例分析】创建数据库bankDB,要求保存在D:\bank
USE master
GO
EXEC xp_cmdshell 'mkdir d:\bank', no_output --创建文件夹D:\bank
IF EXISTS(SELECT * FROM sysdatabases WHERE name='bankDB')
DROP DATABASE bankDB
GO
CREATE DATABASE bankDB
(
…
)
GO --查看文件夹D:\bank
EXEC xp_cmdshell 'dir D:\bank\' --查看文件
剩余11页未读,继续阅读
资源评论
老帽爬新坡
- 粉丝: 79
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功