CreateTableTask
Class CreateTableTask
Creates a table. If the tables exists, this task won't change the table.
Implements
Inherited Members
Namespace: ETLBox.ControlFlow
Assembly: ETLBox.dll
Syntax
Examples
CreateTableTask.Create("demo.table1", new List<TableColumn>() {
new TableColumn(name:"key", dataType:"int", allowNulls:false, isPrimaryKey:true, isIdentity:true),
new TableColumn(name:"value", dataType:"nvarchar(100)", allowNulls:true)
});
Constructors
CreateTableTask()
Declaration
CreateTableTask(TableDefinition)
Declaration
Parameters
Type | Name | Description |
---|---|---|
TableDefinition | tableDefinition |
CreateTableTask(string, List<TableColumn>)
Declaration
Parameters
Type | Name | Description |
---|---|---|
string | tableName | |
List<TableColumn> | columns |
Properties
Columns
The list of columns to create. Either use the TableDefinition or a combination of TableName and TableColumn.
Declaration
Property Value
Type | Description |
---|---|
IList<TableColumn> |
DataTypeConverter
A data type converter that is used to remap the current data type names in the TableDefintion to other, database specific type names. E.g. you can remap that the type VARCHAR(8000) is created as TEXT.
Declaration
Property Value
Type | Description |
---|---|
IDataTypeConverter |
IgnoreCollation
When creating the CREATE TABLE sql, ignore the Collation definition that a TableColumn potentially has.
Declaration
Property Value
Type | Description |
---|---|
bool |
IsTemporaryTable
If set to true, the table will be create as temp table on the database.
Declaration
Property Value
Type | Description |
---|---|
bool |
Sql
The sql code that is used to create the table.
Declaration
Property Value
Type | Description |
---|---|
string |
TN
The formatted table name
Declaration
Property Value
Type | Description |
---|---|
ObjectNameDescriptor |
TableDefinition
The table definition for the table that should be created. Either use the TableDefinition or a combination of TableName and TableColumn.
Declaration
Property Value
Type | Description |
---|---|
TableDefinition |
TableName
The name of the table to create.
Declaration
Property Value
Type | Description |
---|---|
string |
Methods
Alter()
Declaration
Alter(TableDefinition)
Alters a table using ALTER TABLE statements.
Declaration
Parameters
Type | Name | Description |
---|---|---|
TableDefinition | tableDefinition | The definition of the table containing table name and columns. |
Alter(IConnectionManager, TableDefinition)
Alters a table using ALTER TABLE statements.
Declaration
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the database you want to connect |
TableDefinition | tableDefinition | The definition of the table containing table name and columns. |
Alter(IConnectionManager, string, List<TableColumn>)
Alters a table using ALTER TABLE statements.
Declaration
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the database you want to connect |
string | tableName | The name of the table |
List<TableColumn> | columns | The columns of the table |
Alter(string, List<TableColumn>)
Alters a table using ALTER TABLE statements.
Declaration
Parameters
Type | Name | Description |
---|---|---|
string | tableName | The name of the table |
List<TableColumn> | columns | The columns of the table |
AlterIfDifferent()
Execute the alter statements to change the table
Declaration
AlterIfNeeded(TableDefinition)
Alters a table using ALTER TABLE statements.
Declaration
Parameters
Type | Name | Description |
---|---|---|
TableDefinition | tableDefinition | The definition of the table containing table name and columns. |
AlterIfNeeded(IConnectionManager, TableDefinition)
Alters a table using ALTER TABLE statements.
Declaration
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the database you want to connect |
TableDefinition | tableDefinition | The definition of the table containing table name and columns. |
AlterIfNeeded(IConnectionManager, string, List<TableColumn>)
Alters a table using ALTER TABLE statements.
Declaration
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the database you want to connect |
string | tableName | The name of the table |
List<TableColumn> | columns | The columns of the table |
AlterIfNeeded(string, List<TableColumn>)
Alters a table using ALTER TABLE statements.
Declaration
Parameters
Type | Name | Description |
---|---|---|
string | tableName | The name of the table |
List<TableColumn> | columns | The columns of the table |
CheckTableDefinition()
Declaration
Create()
Executes the table creation. Throws an exception if the table exists.
Declaration
Create(TableDefinition)
Creates a table using a CREATE TABLE statement. Throws an exception if the table already exists.
Declaration
Parameters
Type | Name | Description |
---|---|---|
TableDefinition | tableDefinition | The definition of the table containing table name and columns. |
Create(IConnectionManager, TableDefinition)
Creates a table using a CREATE TABLE statement. Throws an exception if the table already exists.
Declaration
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the database you want to connect |
TableDefinition | tableDefinition | The definition of the table containing table name and columns. |
Create(IConnectionManager, string, List<TableColumn>)
Creates a table using a CREATE TABLE statement. Throws an exception if the table already exists.
Declaration
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the database you want to connect |
string | tableName | The name of the table |
List<TableColumn> | columns | The columns of the table |
Create(string, List<TableColumn>)
Creates a table using a CREATE TABLE statement. Throws an exception if the table already exists.
Declaration
Parameters
Type | Name | Description |
---|---|---|
string | tableName | The name of the table |
List<TableColumn> | columns | The columns of the table |
CreateIfNotExists()
Executes the table creation if the table doesn't exist.
Declaration
CreateIfNotExists(TableDefinition)
Creates a table using a CREATE TABLE statement if the table doesn't exist.
Declaration
Parameters
Type | Name | Description |
---|---|---|
TableDefinition | tableDefinition | The definition of the table containing table name and columns. |
CreateIfNotExists(IConnectionManager, TableDefinition)
Creates a table using a CREATE TABLE statement if the table doesn't exist.
Declaration
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the database you want to connect |
TableDefinition | tableDefinition | The definition of the table containing table name and columns. |
CreateIfNotExists(IConnectionManager, string, List<TableColumn>)
Creates a table using a CREATE TABLE statement if the table doesn't exist.
Declaration
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the database you want to connect |
string | tableName | The name of the table |
List<TableColumn> | columns | The columns of the table |
CreateIfNotExists(string, List<TableColumn>)
Creates a table using a CREATE TABLE statement if the table doesn't exist.
Declaration
Parameters
Type | Name | Description |
---|---|---|
string | tableName | The name of the table |
List<TableColumn> | columns | The columns of the table |
CreateOrAlter()
Executes the table creation or execute the corresponding alter statements to adjust the table. If the table is empty, the new table is always dropped and recreated.
Declaration
CreateOrAlter(TableDefinition)
Creates a table if the table doesn't exist or alters a table using ALTER TABLE statements. If the table does not contain any rows, it will be dropped and created again.
Declaration
Parameters
Type | Name | Description |
---|---|---|
TableDefinition | tableDefinition | The definition of the table containing table name and columns. |
CreateOrAlter(IConnectionManager, TableDefinition)
Creates a table if the table doesn't exist or alters a table using ALTER TABLE statements. If the table does not contain any rows, it will be dropped and created again.
Declaration
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the database you want to connect |
TableDefinition | tableDefinition | The definition of the table containing table name and columns. |
CreateOrAlter(IConnectionManager, string, List<TableColumn>)
Creates a table if the table doesn't exist or alters a table using ALTER TABLE statements. If the table does not contain any rows, it will be dropped and created again.
Declaration
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the database you want to connect |
string | tableName | The name of the table |
List<TableColumn> | columns | The columns of the table |
CreateOrAlter(string, List<TableColumn>)
Creates a table if the table doesn't exist or alters a table using ALTER TABLE statements. If the table does not contain any rows, it will be dropped and created again.
Declaration
Parameters
Type | Name | Description |
---|---|---|
string | tableName | The name of the table |
List<TableColumn> | columns | The columns of the table |