GlobalTable_To_File

Serializes tabular data in a global temporary table into a file

  • Stored Procedure
  • SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017

Syntax:

EXEC SQLHTTP.net.GlobalTable_To_File @GlobalTableName, @FilePath, @Delimiter, @FirstRowAsFieldNames

Arguments:

Name Type Description
@GlobalTableName varchar(100) Name of a Global Temporary Table that has been created and populated with data
@FilePath nvarchar(MAX) Full path to a non-existing file
@Delimiter nvarchar(4000) String, usually a single character such as a comma, to be used a row separator
@FirstRowAsFieldNames bit 1 = The column names of the Global Temporary Table will be included as the first row.
0 = Only the Global Temporary Table data will be serialized.

Remarks:

Accessing the file system will be performed in the context of the SQL Server instance process. You can set SQL Server to run using a specific network account, or a Local System Account.

Sample Usage:

This example demonstrates copying the content of a view (OLEDBProviders) into a global temporary table which is then serialized into a file:

See Also: