当前位置:网站首页>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
边栏推荐
猜你喜欢

Getting Started Database Days4

牛客多校4 A.Task Computing 思维

seaborn笔记:可视化统计关系(散点图、折线图)

How to add a game character to a UE4 scene

域名重定向工具 —— SwitchHosts 实用教程

Advanced Algebra_Proof_The algebraic multiplicity of any eigenvalue of a matrix is greater than or equal to its geometric multiplicity

Recycling rental system 100% open source without encryption Mall + recycling + rental

Mini Program Graduation Works WeChat Food Recipe Mini Program Graduation Design Finished Product (8) Graduation Design Thesis Template

深度学习Course2第二周Optimization Algorithms习题整理

力扣第 304 场周赛复盘
随机推荐
2022-08-01 第八组 曹雨 泛型 枚举
小程序毕设作品之微信体育馆预约小程序毕业设计成品(3)后台功能
selenium无头,防检测
数据分析04
Small application project works WeChat stadium booking applet graduation design of the finished product (1) the development profile
小程序毕设作品之微信体育馆预约小程序毕业设计成品(1)开发概要
img 响应式图片的实现(含srcset属性、sizes属性的使用方法,设备像素比详解)
feel so stupid
易周金融分析 | 银行ATM机智能化改造提速;互联网贷款新规带来挑战
number of solutions to solve a multivariate multi-degree equation
不卷了!入职字节跳动一周就果断跑了。
【开源】Sentinel高性能高可用集群限流解决方案
下载安装 vscode(含汉化、插件的推荐和安装)
牛客多校4 A.Task Computing 思维
Today's sleep quality record 74 points
SOM Network 2: Implementation of the Code
[Mobile Web] Mobile terminal adaptation
毕业十年,财富自由:那些比拼命努力更重要的事,从来没人会教你
【牛客刷题-SQL大厂面试真题】NO4.出行场景(某滴打车)
Lecture 3: Several common table field data types in MySQL database