当前位置:网站首页>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
边栏推荐
- xctf attack and defense world web master advanced area webshell
- xctf攻防世界 Web高手进阶区 webshell
- 移动端人脸风格化技术的应用
- Wechat Gymnasium Reservation Mini Program Graduation Design Finished Work Mini Program Graduation Design Finished Product (2) Mini Program Function
- 使用Jenkins做持续集成,这个知识点必须要掌握
- 1. @Component注解的原理剖析
- seaborn笔记:可视化统计关系(散点图、折线图)
- number of solutions to solve a multivariate multi-degree equation
- 毫秒级!千万人脸库快速比对,上亿商品图片检索,背后的极速检索用了什么神器?
- 华为无线设备配置双链路冷备份(AP指定配置方式)
猜你喜欢
威纶通触摸屏如何打开并升级EB8000旧版本项目并更换触摸屏型号?
seaborn笔记:可视化统计关系(散点图、折线图)
JS prototype hasOwnProperty in 加方法 原型终点 继承 重写父类方法
03、GO语言变量定义、函数
[Niu Ke brush questions-SQL big factory interview questions] NO4. Travel scene (a taxi)
JS prototype hasOwnProperty in Add method Prototype end point Inherit Override parent class method
下载安装 vscode(含汉化、插件的推荐和安装)
罗克韦尔AB PLC RSLogix5000中的比较指令使用方法介绍
2022 edition of MySQL tutorial, top collection good, take your time
小程序毕设作品之微信体育馆预约小程序毕业设计成品(1)开发概要
随机推荐
Safe fifth after-school exercise
Recycling rental system 100% open source without encryption Mall + recycling + rental
xss相关知识点以及从 XSS Payload 学习浏览器解码
移动端人脸风格化技术的应用
别看了,这就是你的题呀
[深入研究4G/5G/6G专题-48]: 5G Link Adaption链路自适应-4-下行链路自适应DLLA-PDCCH信道
13、学习MySQL 分组
excel cell contian two words, seperated by a slash
SOM Network 1: Principles Explained
图论——强连通分量缩点+拓扑排序
隔离和降级
1391D. 505 状压dp
(翻译)按钮的对比色引导用户操作的方式
Small application project works WeChat stadium booking applet graduation design of the finished product (1) the development profile
用户体验 | 如何度量用户体验?
2022年最新河北建筑八大员(机械员)模拟考试题库及答案
小程序容器+自定义插件,可实现混合App快速开发
小程序中的多表联合查询
联邦学习入门
more grown, more lonely