SQL Server 2017数据库常见问题(一)

1.查看表中的键的信息
例如:查看表student中的主键,外键的信息

exec sp_helpconstraint 'student'

同理,查看student表中的索引的信息

exec sp_helpindex 'student'

扩展:exec sp_helpxxx 表名 //xxx根据要查找的信息而不同`
这条语句可以查看很多关于表或数据库的详细信息,例如:

exec sp_helpdb 'studentData'  //可以查看到数据库studentData的大小,存储路径等配置信息
exec sp_help 'student' //可以查看表student的详细信息,包括主键外键,索引,创建时间等

猜你喜欢

转载自blog.csdn.net/miha_singh/article/details/80012594