Site sponsored by: Idera The gold standard of SQL Server performance monitoring & diagnostics.
SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Quiz
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
Developer
General DBA
ASP.NET / ADO.NET

Write for Us

Share your SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

Recover Data Using Database Snapshots
Analyze and Fix Index Fragmentation in SQL Server 2008
Powerful Geographical Visualisations made easy with SQL 2008 Spatial (Part 2) ...
Backup User Databases Using a Maintenance Plan

More     
 
Latest FAQ's

How to alter a User Defined Data Type?
How to unzip a File in SSIS?
How to view previous query plans?
ALTER TABLE SWITCH statement failed because the object '%.*ls' is not ...

More     
   
Latest Software Reviews

Spotlight on ApexSQL Doc 2008
ApexSQL Enforce
Embarcadero Change Manager
SQL Server DBA Dashboard

More     

articles >> general dba >> SQL Server 2000 Undocumented Stored Procedures ...

SQL Server 2000 Undocumented Stored Procedures

By : Alexander Chigrik
May 01, 2003

Page 3 / 5


sp_fixindex

This stored procedure can be used to fix corruption in a system table by recreating the index.

Syntax

sp_fixindex dbname, tabname, indid

where

dbname - is the database name. dbname is sysname

tabname - is the system table name. tabname is sysname

indid - is the index id value. indid is int

Note. Before using this stored procedure the database has to be in single user mode.

See this link for more information:

http://www.windows2000faq.com/Articles/Index.cfm?ArticleID=14051

This is the example:

USE pubs

GO

EXEC sp_fixindex pubs, sysindexes, 2

GO





sp_MSforeachdb

Sometimes, you need to perform the same actions for all tables in the database. You can create cursor for this purpose, or you can also use sp_MSforeachdb stored procedure to accomplish the same goal with less work.

For example, you can use this stored procedure to run a CHECKDB for all the databases on your server.

EXEC sp_MSforeachdb @command1="print '?' DBCC CHECKDB ('?')"




sp_MSforeachtable

Sometimes, you need to perform the same actions for all tables in the database. You can create cursor for this purpose, or you can also use sp_MSforeachtable stored procedure to accomplish the same goal with less work.

For example, you can use this stored procedure to rebuild all the indexes in a database.

EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?')"




sp_MShelpcolumns

This stored procedure returns the complete schema for a table, including the length, type, name, and whether a column is computed.

Syntax

sp_MShelpcolumns tablename [, flags] [, orderby] [, flags2]

where

tablename - is the table name. tablename is nvarchar(517).

flags - flags is int, with a default of 0.

orderby - orderby is nvarchar(10), with a default of NULL.

flags - flags2 is int, with a default of 0.

To get the full columns description for the authors table in the pubs database, run:

USE pubs

GO

EXEC sp_MShelpcolumns 'authors'

GO





sp_MShelpindex

This stored procedure returns information about name, status, fill factor, index columns names, and file groups for a given table.

Syntax

sp_MShelpindex tablename [, indexname] [, flags]

where

tablename - is the table name. tablename is nvarchar(517).

indexname - is the index name. indexname is nvarchar(258), with a default of NULL.

flags - flags is int, with a default of NULL.

To get the indexes description for the authors table in the pubs database, run: 

USE pubs

GO

EXEC sp_MShelpindex 'authors'

GO




<< Prev Page     Next Page>>    








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 1999-2008 by T10 Media. All rights reserved