当前位置:网站首页>SQL Server (design database--stored procedure--trigger)
SQL Server (design database--stored procedure--trigger)
2022-08-01 22:37:00 【TL.】
--创建默认值
create default moren as 500
go
--创建规则
create rule newrule as @value between 100 and 150
go
--Bind default values for the columns of the table
sp_bindefault moren,'dbo.orders.OrderNum'
go
--Bind rules for the columns of the table
sp_bindrule newrule,'dbo.orders.OrderNum'
go
--Unbind default values for table columns
sp_unbindefault 'dbo.orders.OrderNum'
go
--Unbind the rules for the columns of the table
sp_bindrule newrule,'dbo.orders.OrderNum'
go
--删除默认值
drop default moren
go
--删除规则
drop rule newrule
go
--添加自定义类型
sp_addtype newtype,'char(500)',null
go
--删除自定义类型
drop type newtype
go
--创建视图
create view newview as select * from dbo.city
go
--删除视图
drop view newview
go
--创建存储过程
create proc procname as select OrderNum,ProdNum from dbo.items
go
--并执行存储过程
exec procname
go
--重命名 旧名--新名
sp_rename procname,newname
go
--删除存储过程
drop proc newname
go
--View a list of all triggers in the system
select * from sysobjects where xtype='tr'
go
--触发器
--newtrigger触发器名字 --在dbo.orders表里的OrderNumcolumn occursupdateThe update event is output
create trigger newtrigger on dbo.orders for update as if update(OrderNum)
print'The order number has been changed,Triggers work'
go
update dbo.orders set OrderNum='133' where OrderNum=101
边栏推荐
- npm包【详解】(内含npm包的开发、发布、安装、更新、搜索、卸载、查看、版本号更新规则、package.json详解等)
- 不卷了!入职字节跳动一周就果断跑了。
- PHP算法之有效的括号
- 深度学习Course2第二周Optimization Algorithms习题整理
- excel vertical to horizontal
- 美赞臣EDI 940仓库装运订单详解
- 【移动Web】移动端适配
- 华为无线设备配置全局双链路冷备份(AC全局配置方式)
- Implementation principle of VGUgarbage collector (garbage collector)
- Getting Started Database Days4
猜你喜欢
xctf attack and defense world web master advanced area webshell
用户体验 | 如何度量用户体验?
罗克韦尔AB PLC RSLogix5000中的比较指令使用方法介绍
img 响应式图片的实现(含srcset属性、sizes属性的使用方法,设备像素比详解)
牛客多校4 A.Task Computing 思维
xctf attack and defense world web master advanced area web2
y84.第四章 Prometheus大厂监控体系及实战 -- prometheus告警机制进阶(十五)
SOM Network 2: Implementation of the Code
03. GO language variable definition, function
华为无线设备配置全局双链路冷备份(AC全局配置方式)
随机推荐
今日睡眠质量记录74分
more grown, more lonely
Still struggling with reporting tool selection?To take a look at this
选择合适的 DevOps 工具,从理解 DevOps 开始
excel edit a cell without double clicking
Graph Theory - Strongly Connected Component Condensation + Topological Sort
数据分析04
PAM 回文自动机
Use Jenkins for continuous integration, this knowledge point must be mastered
Error creating bean with name ‘dataSource‘:Unsatisfied dependency expressed through field ‘basicPro
Advanced Algebra_Proof_The algebraic multiplicity of any eigenvalue of a matrix is greater than or equal to its geometric multiplicity
论文解读(GSAT)《Interpretable and Generalizable Graph Learning via Stochastic Attention Mechanism》
Wechat Gymnasium Appointment Mini Program Graduation Design Finished Work (4) Opening Report
【移动Web】移动端适配
SAP Spartacus NgExpressEngineDecorator 的工作原理
游戏元宇宙发展趋势展望分析
NgRx Store createSelector 的单步调试和源代码分析
blender3.2.1 unit setting
联邦学习的框架搭建
小程序容器+自定义插件,可实现混合App快速开发