exec sp_helpindex 是查询表中是否存在索引,后面跟的是表名 exec sp_helpindex table_name 如果你想查询数据中是否存在指定的索引可以用 if exists (select name from sysindexes where name = '索引名')
exec sp_helpindex student -- 查看约束 exec sp_helpconstraint student -- 查看数据库相关信息 exec sp_helpdb sixstardb -- 通过存储过程对表进行重命名 exec sp_rename 'cous','course' --- -- 自定义存储过程 select *from student -- 1、创建不带参数的存储过程 use sixstardb go if exists(select *...
stno=@fstnogo-- 调用/执行存储过程exec proc_Findstno_student 1007-- 3、创建带通配符参数存储过程if exists(select *from sysobjects where name='proc_FindBystname_student' and type='p')drop procedure proc_FindBystname_studentgocreate proc proc_FindBystname_student(@name char(8)='%小%')asse...
代码示例2 exec有两个语法:第一个,执行存储过程:如果 EXEC SP_XXX第二个,执行组合的命令字符串 --- 常用系统存储过程-- 查询数据库usemasterexecsp_databases-- 查看数据库中的表usesixstardbexecsp_tables-- 查看数据表中的字段execsp_columns student-- 查看索引execsp_helpindex student-- 查看约束execsp_he...
查看索引exec sp_helpindex student-- 查看约束exec sp_helpconstraint student-- 查看数据库相关信息exec sp_helpdb sixstardb-- 通过存储过程对表进行重命名exec sp_rename 'cous','course'--- 自定义存储过程select *from student-- 1、创建不带参数的存储过程use sixstardbgoif exists(select *from sysobjects ...
查看索引execsp_helpindex student-- 查看约束execsp_helpconstraint student-- 查看数据库相关信息execsp_helpdb sixstardb-- 通过存储过程对表进行重命名execsp_rename'cous','course'--- 自定义存储过程select*fromstudent-- 1、创建不带参数的存储过程usesixstardb goifexists(select*fromsysobjectswherename='proc_...