MasterCluster.com Contact   About
Windows Applications Delphi Components SQL Server Extensions Visual C++ Libraries  

xpFileUtils — File Access stored procedures for SQL Server 7.0, 2000, 2005 (Win32)

Library overview

SQL File Access Strored Procedures

Use this library to do the following in T-SQL:


  • Work with drives, directories, and files;
  • Read and write files as random binary data blocks or line-by-line as text;
  • Export and import BLOB data from disk files to table fields of TEXT/NTEXT/IMAGE datatype;
  • Compress and decompress memory data;
  • Create and verify hashes (using MD5 or SHA), and encrypt and decrypt data (using RC2, RC4, or DES).
  • Access internet resources;
  • Work with INI files, and format string templates like C++ sprintf() or Delphi Format() functions do.

These stored procedures are packaged in a dynamic-link library, xpFileUtils.DLL.


This library is available in 2 editions:

  • Professional Edition (How To Buy).
  • Standard Edition (FREE)

NOTE: The Standard and Professional editions include all the procedures (listed below), but only the Professional edition implements all the procedures. For example, it is possible to call xp_DirCreate, but in the Standard edition this procedure does nothing.

Download File Access Stored Procedures for SQL Server DOWNLOAD STANDARD EDITION NOW!
       Price: $0 (FREE)
  • Includes the xpFileUtils.DLL (Standard Edition), sample scripts and a comprehensive reference manual.

  • Order ORDER PRO EDITION NOW!
           Price: $179.95
  • You immediately* receive a download link to Pro Edition right after you will have made your order.
  • Show volume discount prices.
  • Show our Privacy Policy and Order Processing information.

    * For payments made by credit or debit cards, or PayPal.

  • Stored procedures list

    The extended stored procedures are grouped by category where each category provides stored procedures' names, their descriptions and availability in Std and Pro Editions.

    Drive and directory access

    ProcedureDescription StdPro
    xp_DirCreateCreates a new directory.
  • xp_DirExistsChecks if a directory exists.
  • xp_DirRemoveDeletes a directory.
  • xp_DirSizeReturns size of directory and its subdirectories (in bytes).
  • xp_GetDriveSpaceReturns total drive size and its free space size (in bytes).
  • xp_GetDriveTypeDetermines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
  • xp_GetLogicalDrivesRetrieves a bitmask representing the currently available disk drives.
  • xp_GetTempDirReturns the path to Windows TEMP directory.
  • File access

    ProcedureDescription StdPro
    xp_FileAppendLineOpens a text file, appends a line to the end of this file, and then closes this file.
  • xp_FileCloseCloses the file opened by xp_FileOpen.
  • xp_FileConvertConverts the file contents from UNICODE into UTF8 and vice versa.
  • xp_FileCompareCompares contents of two files byte-by-byte.
  • xp_FileCopyCopies a file to another location.
  • xp_FileDeleteDeletes a file.
  • xp_FileExistsChecks if a file exists.
  • xp_FileMoveMoves or renames a file.
  • xp_FileOpenOpens a file for read and/or write access.
  • xp_FileReadReads data from an arbitrary position of a file opened by xp_FileOpen.
  • xp_FileReadContentsReturns the entire file contents as a blob recordset field or as a number of output params.
  • xp_FileReadLineReads text file line-by-line.
  • xp_FileSeekMoves current position of read/write operation for a file opened by xp_FileOpen.
  • xp_FileSizeReturns file size (in bytes).
  • xp_FileWriteWrites data to an arbitrary position of file opened by xp_FileOpen.
  • xp_FileWriteLineWrites a line to the end of the file opened by xp_FileOpen.
  • xp_FindFilesFinds files by a wildcard mask and returns found files as a recordset.
  • xp_GetTempFileReturns a temporary file name.
  • Compression and decompression

    These procedures can compress and decompress custom data using LZ compression algorithm.

    ProcedureDescription StdPro
    xp_ZCreateCreates an internal compressor/decompressor object.
  • xp_ZAppendIncrementally adds data to be compressed/decompressed to an internal buffer.
    This allows to process data streams larger than 8KB.
  • xp_ZCompressCompresses data and returns result as a single row recordset.
  • xp_ZDecompressDecompresses data and returns result as a single row recordset.
  • xp_ZCloseDestroys the object returned by xp_ZCreate.
  • Cryptography

    These procedures use Microsoft Cryptographic API (CryptoAPI).

    They can create and verify hashes (using MD5 or SHA), and encrypt and decrypt data (using RC2, RC4 or DES).

    ProcedureDescription StdPro
    xp_HashCreateCreates a new hash object (MD5 or SHA) and returns a handle on it.
  • xp_HashAppendAppends data to hash.
    This allows to process data streams larger than 8KB.
  • xp_HashCloseReturns hash value and then closes the hash handle.
  • xp_md5_quickReturns MD5-hash on a given value.
  • xp_md5_quick_compareChecks if a given value is OK to a given MD5-hash.
  • xp_sha_quickReturns SHA-hash on a given value.
  • xp_sha_quick_compareChecks if a given value is OK to a given SHA-hash.
  • xp_symmetric_quick_encodeEncodes data with password using either RC2, RC4 or DES algorithm.
  • xp_symmetric_quick_decodeDecodes data protected with password using either RC2, RC4 or DES algorithm.
  • xp_GetRandomDataReturns random bytes data value of a specified length.
  • Internet access

    ProcedureDescription StdPro
    xp_IsPortOpenChecks if a given host name has the given port open.
  • xp_GetAddrByHostReturns the IP address for the given host name.
  • xp_GetHostByAddrReturns the host name for the given IP address.
  • xp_CanPingOnly checks if the destination host can be pinged (e.g. reachable).
  • xp_PingReturns full statistics of ping operation like ping.exe utility does.
  • xp_TraceRouteReturns full statistics of trace route operation like tracert.exe utility does.
  • xp_WhoisOn a given internet address, performs requests to international WHOIS databases and returns any available registration data.
  • INI-file access

    ProcedureDescription StdPro
    xp_IniDeleteKey Deletes a key from INI file.
  • xp_IniDeleteSection Deletes a section from INI file.
  • xp_IniReadKey Reads a key value from INI file.
  • xp_IniWriteKey Writes a key value to INI file.
  • Format string templates

    ProcedureDescription StdPro
    xp_FormatStr Formats strings in C++/Delphi style, like sprintf() or Format() do.
  •   MasterCluster.com © 1999-2010 Leonid Belousov