exec sp_helpindex 是查询表中是否存在索引,后面跟的是表名 exec sp_helpindex table_name 如果你想查询数据中是否存在指定的索引可以用 if exists (select name from sysindexes where name = '索引名')
exec sp_columns student--查看索引 exec sp_helpindex student--查看约束 exec sp_helpconstraint student--查看数据库相关信息 exec sp_helpdb sixstardb--通过存储过程对表进行重命名 exec sp_rename'cous','course'---自定义存储过程 select*from student--1、创建不带参数的存储过程 use sixstardb goifexists...
create proc proc_getstudent as select *from student -- 调用/执行存储过程 exec proc_getstudent -- 2、创建带有参数的存储过程 if exists(select *from sysobjects where name='proc_Findstno_student' and type='p') drop procedure proc_Findstno_student go create proc proc_Findstno_student(@fstno c...
gocreateprocproc_FindBystname_student(@namechar(8)='%小%')asselect*fromstudentwherestnamelike@namego-- 调用/执行存储过程execproc_FindBystname_student'%小%'-- 4、创建带输入输出参数的存储过程ifexists(select*fromsysobjectswherename='proc_FindBystname_student'andtype='p')dropprocedureproc_FindBy...
查看索引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_...