Class RowCountTask
Count the row in a table. This task normally uses the COUNT(*) method (could take some time on big tables).
You can pass a a filter condition for the count.
Namespace: ETLBox.ControlFlow
Assembly: ETLBox.dll
Syntax
public sealed class RowCountTask : ControlFlowTask, ILoggableTask
Examples
int count = RowCountTask.Count("tableName").Value;
Constructors
RowCountTask()
Declaration
RowCountTask(string)
Declaration
public RowCountTask(string tableName)
Parameters
Type | Name | Description |
---|
string | tableName | |
RowCountTask(string, RowCountOptions)
Declaration
public RowCountTask(string tableName, RowCountOptions options)
Parameters
RowCountTask(string, string)
Declaration
public RowCountTask(string tableName, string condition)
Parameters
RowCountTask(string, string, RowCountOptions)
Declaration
public RowCountTask(string tableName, string condition, RowCountOptions options)
Parameters
Properties
Condition
Part of the sql where condition which restrict which rows are counted
Declaration
public string Condition { get; set; }
Property Value
DirtyRead
Will do the row count also on uncommitted reads.
Declaration
public bool DirtyRead { get; }
Property Value
Options
For Sql Server, you can set the QuickQueryMode to true. This will query the sys.partition table which can be much faster.
If set to DirtyRead, the count will also read uncommitted rows.
If set ReadOnlyFirstRow, the count will use a limit when running
Declaration
public RowCountOptions Options { get; set; }
Property Value
QuickQueryMode
For Sql Server, you can set the QuickQueryMode to true. This will query the sys.partition table which can be much faster.
Declaration
public bool QuickQueryMode { get; }
Property Value
Rows
Will hold the number of counted rows after execution
Declaration
public int? Rows { get; }
Property Value
Sql
The sql that is executed to count the rows in the table - will change depending on your parameters.
Declaration
public string Sql { get; }
Property Value
TN
The formatted table table name
Declaration
public ObjectNameDescriptor TN { get; }
Property Value
TableName
Name of the table on which the rows are counted
Declaration
public string TableName { get; set; }
Property Value
Methods
Count()
Declaration
Returns
Count(IConnectionManager, string)
Declaration
public static int Count(IConnectionManager connectionManager, string tableName)
Parameters
Returns
Count(IConnectionManager, string, RowCountOptions)
Declaration
public static int Count(IConnectionManager connectionManager, string tableName, RowCountOptions options)
Parameters
Returns
Count(IConnectionManager, string, string)
Declaration
public static int Count(IConnectionManager connectionManager, string tableName, string condition)
Parameters
Returns
Count(IConnectionManager, string, string, RowCountOptions)
Declaration
public static int Count(IConnectionManager connectionManager, string tableName, string condition, RowCountOptions options)
Parameters
Returns
Count(string)
Declaration
public static int Count(string tableName)
Parameters
Type | Name | Description |
---|
string | tableName | |
Returns
Count(string, RowCountOptions)
Declaration
public static int Count(string tableName, RowCountOptions options)
Parameters
Returns
Count(string, string)
Declaration
public static int Count(string tableName, string condition)
Parameters
Returns
Count(string, string, RowCountOptions)
Declaration
public static int Count(string tableName, string condition, RowCountOptions options)
Parameters
Returns
CountAsync()
Declaration
public Task<int> CountAsync()
Returns
CountAsync(IConnectionManager, string)
Declaration
public static Task<int> CountAsync(IConnectionManager connectionManager, string tableName)
Parameters
Returns
CountAsync(IConnectionManager, string, RowCountOptions)
Declaration
public static Task<int> CountAsync(IConnectionManager connectionManager, string tableName, RowCountOptions options)
Parameters
Returns
CountAsync(IConnectionManager, string, string)
Declaration
public static Task<int> CountAsync(IConnectionManager connectionManager, string tableName, string condition)
Parameters
Returns
CountAsync(IConnectionManager, string, string, RowCountOptions)
Declaration
public static Task<int> CountAsync(IConnectionManager connectionManager, string tableName, string condition, RowCountOptions options)
Parameters
Returns
HasRows()
Checks if the table has at least one (matching) row.
Declaration
Returns
HasRows(IConnectionManager, string)
Declaration
public static bool HasRows(IConnectionManager connectionManager, string tableName)
Parameters
Returns
HasRows(IConnectionManager, string, RowCountOptions)
Declaration
public static bool HasRows(IConnectionManager connectionManager, string tableName, RowCountOptions options)
Parameters
Returns
HasRows(IConnectionManager, string, string)
Declaration
public static bool HasRows(IConnectionManager connectionManager, string tableName, string condition)
Parameters
Returns
HasRows(IConnectionManager, string, string, RowCountOptions)
Declaration
public static bool HasRows(IConnectionManager connectionManager, string tableName, string condition, RowCountOptions options)
Parameters
Returns
HasRows(string)
Declaration
public static bool HasRows(string tableName)
Parameters
Type | Name | Description |
---|
string | tableName | |
Returns
HasRows(string, RowCountOptions)
Declaration
public static bool HasRows(string tableName, RowCountOptions options)
Parameters
Returns
HasRows(string, string)
Declaration
public static bool HasRows(string tableName, string condition)
Parameters
Returns
HasRows(string, string, RowCountOptions)
Declaration
public static bool HasRows(string tableName, string condition, RowCountOptions options)
Parameters
Returns
Implements