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

毕业十年,财富自由:那些比拼命努力更重要的事,从来没人会教你

移动端人脸风格化技术的应用

Postman 批量测试接口详细教程

小程序毕设作品之微信美食菜谱小程序毕业设计成品(7)中期检查报告

小程序毕设作品之微信美食菜谱小程序毕业设计成品(5)任务书

今日睡眠质量记录74分

xss相关知识点以及从 XSS Payload 学习浏览器解码

解决yolov5训练时出现:“AssertionError: train: No labels in VOCData/dataSet_path/train.cache. Can not train ”

一种灵活的智能合约协作方式

blender3.2.1 unit setting
随机推荐
图论——强连通分量缩点+拓扑排序
如何防范 DAO 中的治理攻击?
【牛客刷题-SQL大厂面试真题】NO4.出行场景(某滴打车)
如何给 UE4 场景添加游戏角色
文件查询匹配神器 【glob.js】 实用教程
关于ETL的两种架构(ETL架构和ELT架构)
域名重定向工具 —— SwitchHosts 实用教程
联邦学习在金融领域的发展和应用
力扣第 304 场周赛复盘
Wechat Gymnasium Appointment Mini Program Graduation Design Finished Work (4) Opening Report
SQL29 Calculate the average next day retention rate of users
leetcode 204. Count Primes 计数质数 (Easy)
移动端人脸风格化技术的应用
Graph Theory - Strongly Connected Component Condensation + Topological Sort
工程建筑行业数据中台指标分析
线上故障排查方案
Yizhou Financial Analysis | The intelligent transformation of bank ATM machines is accelerated; the new Internet loan regulations bring challenges
隔离和降级
13、学习MySQL 分组
(Translation) How the contrasting color of the button guides the user's actions