惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Jina AI
Jina AI
C
Check Point Blog
V
V2EX
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
A
About on SuperTechFans
D
DataBreaches.Net
腾讯CDC
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
IT之家
IT之家
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
云风的 BLOG
云风的 BLOG
MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
博客园_首页
T
Tailwind CSS Blog
M
MIT News - Artificial intelligence
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - 上海-天浩

ASP.NET WebApi(.Net Framework) 应用CacheManager 软件工程的核心问题并非是编程 C# 生产消费模式 C# ConcurrentQueue 处理多任务 c# 线程池多任务处理并返回值 最近忙的一个项目(B/S) 共享设备综合运营管理系统(自研) 自动充值机 面向对象的七种设计原则 做过的项目 诗二首 诗三首 开源大全 C# PowerPoint操作的基本用法。 无锡质检局实验室管理系统 交互式电子白板 自己开发的 漂亮音乐播放器 钥匙齿形识别系统
SQL server 添加主外键约束
上海-天浩 · 2017-12-08 · via 博客园 - 上海-天浩

---添加主键约束            

alter table 表名      

add constraint 约束名 primary key (主键)          -

--添加唯一约束           

alter table 表名              

add constraint 约束名 unique (字段)       

---添加默认约束          

alter table 表名         

add constraint 约束名 default ('默认内容') for 字段             

--添加检查check约束,要求字段只能在1到100之间             

alter table 表名 

add constraint 约束名 check (字段 between 1 and 100 )        

---添加外键约束(主表stuInfo和从表stuMarks建立关系,关联字段为stuNo)    

        

alter table 从表              

add constraint 约束名 <br>   foreign key(关联字段) references 主表(关联字段)      

sql server中删除约束的语句是:          

alter table 表名 drop constraint 约束名             

sp_helpconstraint 表名 找到数据表中的所有列的约束