SQL Server 7.0 Undocumented Stored Procedures

sp_MSexists_file

Used to determine whether a particular file exists in a particular folder or not.

Syntax

EXEC sp_MSexits_file full_path, filename

where

full_path – is the full path to the file name, full_path is nvarchar(512)

filename – is the file name, filename is nvarchar(255)

To check if file textcopy.exe exists in the C:MSSQL7BINN directory (path by default), run:


DECLARE @retcode int


EXEC @retcode = sp_MSexists_file ‘C:MSSQL7BINN’, ‘textcopy.exe’


IF @retcode = 1


PRINT ‘File Exist’


ELSE


PRINT ‘File does not Exist’


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

Continues…

Leave a comment

Your email address will not be published.