exec sp_helpindex 是查询表中是否存在索引,后面跟的是表名 exec sp_helpindex table_name 如果你想查询数据中是否存在指定的索引可以用 if exists (select name from sysindexes where name = '索引名')
use sixstardb exec sp_tables--查看数据表中的字段 exec sp_columns student--查看索引 exec sp_helpindex student--查看约束 exec sp_helpconstraint student--查看数据库相关信息 exec sp_helpdb sixstardb--通过存储过程对表进行重命名 exec sp_rename'cous','course'---自定义存储过程 select*from student--...
exec sp_tables -- 查看数据表中的字段 exec sp_columns student -- 查看索引 exec sp_helpindex student -- 查看约束 exec sp_helpconstraint student -- 查看数据库相关信息 exec sp_helpdb sixstardb -- 通过存储过程对表进行重命名 exec sp_rename 'cous','course' --- -- 自定义存储过程 select *from...
代码示例1 create database test_0425 -- 创建数据库gouse test_0425go-- 建表create table student(stno int primary key,stsex char(4) not null,stname char(10) not null,stspecialty char(20) not null,stscore int not null)go-- 设置检查约束,性别只能输入 男或女alter table studentadd constrai...
查看索引execsp_helpindex student-- 查看约束execsp_helpconstraint student-- 查看数据库相关信息execsp_helpdb sixstardb-- 通过存储过程对表进行重命名execsp_rename'cous','course'--- 自定义存储过程select*fromstudent-- 1、创建不带参数的存储过程usesixstardb goifexists(select*fromsysobjectswherename='proc_...
查看索引execsp_helpindex student-- 查看约束execsp_helpconstraint student-- 查看数据库相关信息execsp_helpdb sixstardb-- 通过存储过程对表进行重命名execsp_rename'cous','course'--- 自定义存储过程select*fromstudent-- 1、创建不带参数的存储过程usesixstardb goifexists(select*fromsysobjectswherename='proc_...