SQL Server 2000 Useful undocumented stored procedures
Alexander Chigrik
chigrik@hotmail.com
Alexander Chigrik's
Home
Introduction
In this article, I want to tell you about some useful undocumented stored procedures shipped with SQL Server 2000.
| sp_MSget_qualified_name |
sp_MSget_qualified_name object_id, qualified_name |
USE pubs
GO
declare @object_id int, @qualified_name nvarchar(512)
select @object_id = object_id('authors')
EXEC sp_MSget_qualified_name @object_id, @qualified_name output
select @qualified_name
GO
|
-------------------------------------- [dbo].[authors] |
| sp_MSdrop_object |
sp_MSdrop_object [object_id] [,object_name] [,object_owner] |
USE pubs
GO
declare @object_id int
select @object_id = object_id('titleauthor')
EXEC sp_MSdrop_object @object_id
GO
|
| sp_gettypestring |
sp_gettypestring tabid, colid, typestring |
USE pubs
GO
declare @tabid int, @typestring nvarchar(255)
select @tabid = object_id('authors')
EXEC sp_gettypestring @tabid, 2, @typestring output
select @typestring
GO
|
------------------------------- varchar(40) |
| sp_MSgettools_path |
sp_MSgettools_path install_path |
USE master GO declare @install_path NVARCHAR(260) EXEC sp_MSgettools_path @install_path OUTPUT select @install_path GO |
------------------------------------------------------------ C:\Program Files\Microsoft SQL Server\80\Tools |
| sp_MScheck_uid_owns_anything |
sp_MScheck_uid_owns_anything uid |
USE pubs GO EXEC sp_MScheck_uid_owns_anything 1 GO |
| sp_columns_rowset |
sp_columns_rowset table_name [, table_schema ] [, column_name] |
USE pubs GO EXEC sp_columns_rowset 'authors' GO |
| sp_fixindex |
sp_fixindex dbname, tabname, indid |
USE pubs GO EXEC sp_fixindex pubs, sysindexes, 2 GO |
| sp_MSforeachdb |
EXEC sp_MSforeachdb @command1="print '?' DBCC CHECKDB ('?')"
|
| sp_MSforeachtable |
EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?')"
|
| sp_MShelpcolumns |
sp_MShelpcolumns tablename [, flags] [, orderby] [, flags2] |
USE pubs GO EXEC sp_MShelpcolumns 'authors' GO |
| sp_MShelpindex |
sp_MShelpindex tablename [, indexname] [, flags] |
USE pubs GO EXEC sp_MShelpindex 'authors' GO |
| sp_MShelptype |
sp_MShelptype [typename] [, flags] |
USE pubs GO EXEC sp_MShelptype GO |
| sp_MSindexspace |
sp_MSindexspace tablename [, index_name] |
USE pubs GO EXEC sp_MSindexspace 'authors' GO |
| sp_MSkilldb |
sp_MSkilldb dbname |
USE master GO EXEC sp_MSkilldb 'pubs' GO |
| sp_MStablespace |
sp_MStablespace name [, id] |
USE pubs GO EXEC sp_MStablespace 'authors' GO |
Rows DataSpaceUsed IndexSpaceUsed ----------- ------------- -------------- 23 8 32 |
| sp_tempdbspace |
sp_tempdbspace |
EXEC sp_tempdbspace |
database_name database_size spaceused ------------- ----------------------- ----------------------------- tempdb 9.750000 .562500 |
| sp_who2 |
sp_who [loginame] |
EXEC sp_who2 'sa' |
| Is
SQL the Center of your Universe? SQLCentric is a comprehensive web-based network database monitoring and alert system. - brought to you by Pearl Knowledge Solutions, Inc. http://www.pearlknows.com |
|
|
|||||
Copyright © 2002-2003 Central Publishing Group. All Rights Reserved. | |||||