当前位置: 数据库>sqlserver
SQL Server 数据库实用SQL语句
来源: 互联网 发布时间:2014-10-09
本文导语: --查看指定表的外键约束 select * from sysobjects where parent_obj in( select id from sysobjects where name='表名') and xtype='PK' --查看所有表 select * from sysobjects where xtype='PK' --删除列中含数字的 delete news where patindex('%[0-9]%',title)>0 --删除删去 字段 t...
--查看指定表的外键约束
select * from sysobjects where parent_obj in(
select id from sysobjects where name='表名')
and xtype='PK'
--查看所有表
select * from sysobjects where xtype='PK'
--删除列中含数字的
delete news where patindex('%[0-9]%',title)>0
--删除删去 字段 title值重复的行,且只保留 id 较小的这个
delete news where exists(select 1 from news t where t.title=news.title and t.id
select * from sysobjects where parent_obj in(
select id from sysobjects where name='表名')
and xtype='PK'
--查看所有表
select * from sysobjects where xtype='PK'
--删除列中含数字的
delete news where patindex('%[0-9]%',title)>0
--删除删去 字段 title值重复的行,且只保留 id 较小的这个
delete news where exists(select 1 from news t where t.title=news.title and t.id