Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
6Activity
0 of .
Results for:
No results containing your search query
P. 1
MSSQL Extended Stored Procedures

MSSQL Extended Stored Procedures

Ratings: (0)|Views: 2,147 |Likes:
Published by Raj
MSSQL Extended Stored Procedures
MSSQL Extended Stored Procedures

More info:

Published by: Raj on Apr 01, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

09/04/2012

pdf

text

original

 
1Prepared By : Ramesh
 MS SQL ServerDBCC Commands
 
2Prepared By : Ramesh
Extended Stored Procedures
These are some documented and undocumented extended stored procedures. These proceduresexpand the flexibility of T-SQL to allow you to interact with the Windows operating system.Most of the procedures in this section are undocumented and are not supported by Microsoft.
xp_availablemedia
The
xp_availablemedia
extended stored procedure lists the drives that are available to read andwrite data. To execute the procedure, use the following syntax:
master..xp_availablemedia
This outputs the name of the drive, the free space in bytes (shown as low free) and the type of drive. Some of the types of drives you can see in the following results are a floppy drive (1), ahard drive (2), and a writable CD-ROM (8):
name low free high free media type------------------------------ ----------- ----------- ----------A:\ 884736 0 1C:\ 1993347072 0 2D:\ 1982103552 5 2F:\ 679477248 0 8
xp_cmdshell
The
xp_cmdshell
extended stored procedure is a commonly used procedure to execute programsusing T-SQL. For example, you can use the procedure to execute a DTS package by using thefollowing syntax:
master..xp_cmdshell 'DTSRun /S "servername" /U "username"/P "password" /N "DTSPackageName"'
This outputs the following results:
output--------------------------------------------------DTSRun: Loading...DTSRun: Executing...DTSRun OnStart: DTSStep_DTSExecuteSQLTask_1DTSRun OnFinish: DTSStep_DTSExecuteSQLTask_1DTSRun: Package execution complete.NULL
If you don't want the procedure to produce any output, use the no_output parameter.
xp_dirtree
 
3Prepared By : Ramesh
The
xp_dirtree
extended stored procedure reports all of the subdirectories under the specifiedroot directory. For example, if you'd like to determine which directories exist under theC:\Program Files\Microsoft SQL Server\MSSQL\BACKUP folder, use the following syntax:
master..xp_dirtree 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP'
This outputs all the directories under the specified directory as shown here:
subdirectory depth-------------------------------------------------- -----------Northwind 1TranBackups 2Pubs 1
The depth column shows how deep under the specified directory the directory named in thesubdirectory column is. If you don't want the depth column, use the
xp_subdirs
procedure withthe same parameters.
xp_enum_activescriptengines
The
xp_enum_activescriptengines
procedure lists all the scripting languages installed on theserver. To execute the procedure, use the following syntax:
master..xp_enum_activescriptengines
This outputs the following results, which may vary based on the installed languages:
Program ID Description------------------------------ ------------------------------XML XML Script EngineVBScript VB Script LanguageVBScript.Encode VBScript Language EncodingJScript JScript LanguageJScript.Encode JScript Language Encoding
xp_enum_oledb_providers
The
xp_enum_oledb_providers
procedure outputs all the installed OLE DB providers on theserver. To execute the procedure, use the following syntax:
master..xp_enum_oledb_providers
This results in the following results (mine are abridged):
Provider Name Provider Description-------------------------- ------------------------------------------Microsoft.ISAM.OLEDB.1.1 Microsoft ISAM 1.1 OLE DB ProviderMSDAORA Microsoft OLE DB Provider for OracleDTSPackageDSO Microsoft OLE DB Provider for DTS Packages

Activity (6)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
ameshlal liked this
ajviradia liked this
cann63260 liked this
mbothe liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->