当前位置:网站首页>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
边栏推荐
- 基于 OData 模型和 JSON 模型的 SAP UI5 表格控件行项目的添加和删除实现
- Today's sleep quality record 74 points
- 毕业十年,财富自由:那些比拼命努力更重要的事,从来没人会教你
- RxJs SwitchMapTo 操作符之移花接木
- 下载安装 vscode(含汉化、插件的推荐和安装)
- 深度学习Course2第一周Practical aspects of Deep Learning习题整理
- dvwa 通关记录1 - 暴力破解 Brute Force
- 文件查询匹配神器 【glob.js】 实用教程
- long investment career
- 高等代数_证明_矩阵的行列式为特征值之积, 矩阵的迹为特征值之和
猜你喜欢
随机推荐
Deep Learning Course2 Week 2 Optimization Algorithms Exercises
Mini Program Graduation Works WeChat Food Recipe Mini Program Graduation Design Finished Product (8) Graduation Design Thesis Template
Deep learning Course2 first week Practical aspects of Deep Learning exercises
PHP算法之电话号码的字母组合
数据分析04
一种灵活的智能合约协作方式
[Mobile Web] Mobile terminal adaptation
No more rolls!After joining ByteDance for a week, he ran decisively.
用户体验 | 如何度量用户体验?
2022年最新河北建筑八大员(机械员)模拟考试题库及答案
今日睡眠质量记录74分
Small application project works WeChat stadium booking applet graduation design of the finished product (1) the development profile
熟悉的朋友
关于ETL的两种架构(ETL架构和ELT架构)
excel change cell size
SOM Network 2: Implementation of the Code
感觉自己好傻
Wechat Gymnasium Reservation Mini Program Graduation Design Finished Work Mini Program Graduation Design Finished Product (2) Mini Program Function
【移动Web】移动端适配
小程序毕设作品之微信体育馆预约小程序毕业设计成品(2)小程序功能









