Contact   About
Apps for Windows Source Code SQL Server Extensions  

File Access Stored Procedures for SQL Server 2005 and later (.NET)

Library overview (version

Access file system from T-SQL:

  • Work with drives, directories, and files
  • Read and write files (random binary data blocks or line-by-line as text)
  • Import BLOB data from disk files to table fields of TEXT/NTEXT/IMAGE datatype

This extended stored procedures library works with SQL Server 2005 and later.

You can use this library on 32 bit and 64 bit SQL Server editions, because it is a .NET dynamic-link library.

The library is available in 2 editions:

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 xpn_DirCreate, but this procedure immediately exits in the Standard edition.
SQL File Access Strored Procedures

Get It Here!

  1. Download FREE Standard Edition (500K download size) including sample scripts and a comprehensive reference manual in CHM format.
  2. Read our Privacy Policy and Order Processing information.
  3. Buy the Professional Edition using a safe payment processing service from Share*it!. Volume discount prices available.

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 & directory access

  • xpn_DirCreateCreates a new directory.
  • xpn_DirExistsChecks if a directory exists.
  • xpn_DirRemoveDeletes a directory.
  • xpn_DirSizeReturns size of directory and its subdirectories (in bytes).
  • xpn_GetDriveSpaceReturns total drive size and its free space size (in bytes).
  • xpn_GetDriveTypeDetermines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
  • xpn_GetLogicalDrivesRetrieves a bitmask representing the currently available disk drives.
  • xpn_GetTempDirReturns the path to Windows TEMP directory.

    File access

  • xpn_FileAppendLineOpens a text file, appends a line to the end of this file, and then closes this file.
  • xpn_FileCloseCloses the file opened by xpn_FileOpen.
  • xpn_FileConvertConverts the file contents from UNICODE into UTF8 and vice versa.
  • xpn_FileCompareCompares the content of two files byte-to-byte.
  • xpn_FileCopyCopies a file to another location.
  • xpn_FileDeleteDeletes a file.
  • xpn_FileExistsChecks if a file exists.
  • xpn_FileMoveMoves or renames a file.
  • xpn_FileOpenOpens a file for read and/or write access.
  • xpn_FileReadBinaryReads binary data from an arbitrary position of a file opened by xpn_FileOpen.
  • xpn_FileReadCharsReads character data from an arbitrary position of a file opened by xpn_FileOpen.
  • xpn_FileReadContentReturns the entire content of a file as a BLOB recordset field.
  • xpn_FileReadLineReads text file line-by-line.
  • xpn_FileSeekMoves current position of read/write operation for a file opened by xpn_FileOpen.
  • xpn_FileSizeReturns file size (in bytes).
  • xpn_FileWriteBinaryWrites binary data to an arbitrary position of file opened by xpn_FileOpen.
  • xpn_FileWriteCharsWrites character data to an arbitrary position of file opened by xpn_FileOpen.
  • xpn_FileWriteLineWrites a line to the end of the file opened by xpn_FileOpen.
  • xpn_FindFilesFinds files by a wildcard mask and returns found files as a recordset.
  • xpn_GetTempFileReturns a temporary file name.

    Related Documents

    File Access Stored Procedures for SQL Server 7.0, 2000, 2005 and later (Win32)
    Delphi extended stored procedure component for SQL Server 7.0, 2000, 2005
    C++ Extended stored procedure class for SQL Server 7.0, 2000, 2005
    Copyright © 2003-2017
    Share |