1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > sql server删除外键约束

sql server删除外键约束

时间:2023-05-03 13:09:50

相关推荐

sql server删除外键约束

数据库|mysql教程

server,除外,约束

数据库-mysql教程

火车头php源码下载,vscode 编辑多个文件,战66 ubuntu,tomcat针对并发优化,sqlite两个表筛选,数据爬虫只采集手机号违法吗,html2pdf php,宜春市seo公司,qq技术网站源码,养生招聘信息模板lzw

create table test1(id int primary key not null,value int) insert test1 select 1,2 go –从表 create table test2(id int references test1(id),value int) go –第一步:找出test2表上的外键约束名字 –2000 exec sp_helpconstraint ‘test2’ –可以

企业网站源码下载,vscode 优势,手机ubuntu rom,tomcat 8.52,sqlite 保存音乐,构建数据库服务器,idetools 易语言ide插件支持库,前端框架themlef 引入,爬虫 手机app,php攻城狮,seo课程培训机构,微博网站源码,怎么看网站后台网页尺寸,网站下载织梦模板,好看的html5表单页面,jsp社区管理系统论文,破解程序的源代码lzw

libuidk 源码,ubuntu怎么下载pip,TOMCAT多机集群配置,f语言 爬虫,免费php空间,海珠区第三方seo优化怎么样lzw

create table test1(id int primary key not null,value int)

insert test1 select 1,2

go

–从表

create table test2(id int references test1(id),value int)

go

–第一步:找出test2表上的外键约束名字

–2000

exec sp_helpconstraint ‘test2’

–可以在constraint_name 属性中找到外键约束名字

select name

from sys.foreign_key_columns f join sys.objects o on f.constraint_object_id=o.object_id

where f.parent_object_id=object_id(‘test2’)

/*

name

———————————

FK__test2__id__08EA5793*/

–第二步:删除外键约束

alter table test2 drop constraint FK__test2__id__08EA5793

–第三步:检查表上是否还有外键约束

–只要使用第一步里面的查找语句即可

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。