LassoScript Utility
Basics Browse Detail

[Database_CreateTable]

Tag Link [Database_CreateTable] Category Database
Type Process Source Available Yes
Support Preferred Version 5.0
Change Unchanged Data Source Lasso MySQL
Output Type None Security Tag
Implementation LDML Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0

Description

[Database_CreateTable] creates a new table in an existing MySQL database. By calling the [Database_CreateTable] tag and a series of [Database_CreateField] tags a new table can be created entirely in LassoScript.

This tag is certified to work with Lasso MySQL and MySQL data sources. It may also work with third party data sources that support the -SQL command tag.

This tag requires a -Database parameter that specifies in which database the table should be created. The database must already exist and the current user must have permission to execute -SQL actions.

The -Table parameter specifies the name of the table to be created.

The table is automatically created with a single field named ID. The field is set to be a primary key field and to auto-increment. In general, this field can be used as the primary key field for the table, or it can be deleted and a new primary key field can be created in its place.

The optional -Temporary parameter allows a temporary table to be created. Temporary tables are deleted when Lasso MySQL or MySQL restarts.

Syntax

[Database_CreateTable-Database='Database Name'
  -Table='Table Name']

[Database_CreateTable-Database='Database Name'
  -Table='Table Name',
  -Temporary]

Parameters

Required Parameters
-Database The name of the database to which the table should be added.
-Table The name of the table which should be added to the specified database.
Optional Parameters
-Temporary If specified, the created table will be temporary.

Examples

To create a new Lasso MySQL Table:

Use the [Database_CreateTable] tag. The following code creates a new table in the Site database named MyPreferences.

[Database_CreateTable-Database='Site', -Table='MyPreferences']