Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » Security FunctionsRSS Feeds

fn_trace_gettable Function

Posted By: Sarita Patel     Category: SQL Server     Views: 3312

This article explains about fn_trace_gettable function in sql server with examples.

fn_trace_gettable returns trace file information in a table format. It provides a mechanism for querying trace data stored in a file (trace_filename.trc). fn_trace_gettable can be used in a SELECT...INTO statement to load the data in the file into a SQL Server table.



Syntax of fn_trace_gettable Function :

fn_trace_gettable( [ @filename= ] filename, [ @numfiles = ] number_files)

[ @filename= ] filename specifies the initial trace to be read. filename is of type nvarchar(256).

[ @numfiles = ] number_files specifies the number of rollover files, including the initial file specified in filename, to be read. number_files is of type int. Users may specify the default value "default" to tell SQL Server to read all rollover files until the end of the trace.

It returns a table with all the valid columns. 




Examples of fn_trace_gettable Function :

Example 1 : Use of fn_trace_gettable function in select clause 

SELECT * INTO Customer_trc
FROM    ::fn_trace_gettable(c:\Customer_trace.trc", default)


Above example calls the function as part of a SELECT...INTO statement and returns a table that can be loaded into SQL Profiler.
  
Share: 

 
 

Didn't find what you were looking for? Find more on fn_trace_gettable Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of fn_trace_gettable Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!