# TableSchema

> TableSchema represents the metadata of a database table.

[API reference](/docs/api/index.md) › [yii](/docs/api/yii/index.md) › [db](/docs/api/yii/db/index.md) › [mssql](/docs/api/yii/db/mssql/index.md) › TableSchema

| class | `yii\db\mssql\TableSchema` |
| --- | --- |
| Extends | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) » [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| Implements | [`yii\base\Configurable`](/docs/api/yii/base/configurable/index.md) |
| Since | 2.0 |
| Source | [`framework/db/mssql/TableSchema.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/db/mssql/TableSchema.php#L19) |

TableSchema represents the metadata of a database table.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| [`$catalogName`](#property-catalogName) | `string\|null` | Name of the catalog (database) that this table belongs to. Default: `null`. | `TableSchema` |
| <span id="property-columnNames"></span>[`$columnNames`](/docs/api/yii/db/tableschema/index.md#property-columnNames) read-only | `array` | List of column names. | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) |
| <span id="property-columns"></span>[`$columns`](/docs/api/yii/db/tableschema/index.md#property-columns) | [`yii\db\ColumnSchema`](/docs/api/yii/db/columnschema/index.md)`[]` | Column metadata of this table. Default: `[]`. | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) |
| <span id="property-foreignKeys"></span>[`$foreignKeys`](/docs/api/yii/db/tableschema/index.md#property-foreignKeys) | `array` | Foreign keys of this table. Default: `[]`. | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) |
| <span id="property-fullName"></span>[`$fullName`](/docs/api/yii/db/tableschema/index.md#property-fullName) | `string` | The full name of this table, which includes the schema name prefix, if any. Default: `null`. | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) |
| <span id="property-name"></span>[`$name`](/docs/api/yii/db/tableschema/index.md#property-name) | `string` | The name of this table. Default: `null`. | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) |
| <span id="property-primaryKey"></span>[`$primaryKey`](/docs/api/yii/db/tableschema/index.md#property-primaryKey) | `string[]` | Primary keys of this table. Default: `[]`. | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) |
| <span id="property-schemaName"></span>[`$schemaName`](/docs/api/yii/db/tableschema/index.md#property-schemaName) | `string` | The name of the schema that this table belongs to. Default: `null`. | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) |
| <span id="property-sequenceName"></span>[`$sequenceName`](/docs/api/yii/db/tableschema/index.md#property-sequenceName) | `string\|null` | Sequence name for the primary key. Default: `null`. | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| <span id="method-__construct"></span>[`__construct()`](/docs/api/yii/base/baseobject/index.md#method-__construct) | Constructor. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__call"></span>[`__call()`](/docs/api/yii/base/baseobject/index.md#method-__call) | Calls the named method which is not a class method. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__get"></span>[`__get()`](/docs/api/yii/base/baseobject/index.md#method-__get) | Returns the value of an object property. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__isset"></span>[`__isset()`](/docs/api/yii/base/baseobject/index.md#method-__isset) | Checks if a property is set, i.e. defined and not null. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__set"></span>[`__set()`](/docs/api/yii/base/baseobject/index.md#method-__set) | Sets value of an object property. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__unset"></span>[`__unset()`](/docs/api/yii/base/baseobject/index.md#method-__unset) | Sets an object property to null. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-canGetProperty"></span>[`canGetProperty()`](/docs/api/yii/base/baseobject/index.md#method-canGetProperty) | Returns a value indicating whether a property can be read. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-canSetProperty"></span>[`canSetProperty()`](/docs/api/yii/base/baseobject/index.md#method-canSetProperty) | Returns a value indicating whether a property can be set. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-className"></span>[`className()`](/docs/api/yii/base/baseobject/index.md#method-className) static | Returns the fully qualified name of this class. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-fixPrimaryKey"></span>[`fixPrimaryKey()`](/docs/api/yii/db/tableschema/index.md#method-fixPrimaryKey) | Manually specifies the primary key for this table. | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) |
| <span id="method-getColumn"></span>[`getColumn()`](/docs/api/yii/db/tableschema/index.md#method-getColumn) | Gets the named column metadata. | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) |
| <span id="method-getColumnNames"></span>[`getColumnNames()`](/docs/api/yii/db/tableschema/index.md#method-getColumnNames) | Returns the names of all columns in this table. | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) |
| <span id="method-hasMethod"></span>[`hasMethod()`](/docs/api/yii/base/baseobject/index.md#method-hasMethod) | Returns a value indicating whether a method is defined. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-hasProperty"></span>[`hasProperty()`](/docs/api/yii/base/baseobject/index.md#method-hasProperty) | Returns a value indicating whether a property is defined. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-init"></span>[`init()`](/docs/api/yii/base/baseobject/index.md#method-init) | Initializes the object. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |

## Property details

### $catalogName <span id="property-catalogName"></span>

```php
public string|null $catalogName = null
```

Name of the catalog (database) that this table belongs to.

Defaults to null, meaning no catalog (or the current database).