แก้ไข

แชร์ผ่าน


Create and update database tables

Applies to: SQL Server

The Table Designer is a visual tool where you design and visualize database tables. To create, edit, or delete tables, columns, keys, indexes, relationships, and constraints, use the Table Designer in Download SQL Server Management Studio (SSMS) or Azure Data Studio (ADS).

Create a table

  1. Right-click the Tables node in your database and select New > Table in SSMS, or New Table in ADS.
  2. Add columns to your table, specifying name, data type, and whether NULL values are allowed for each column.
  3. Other table properties can be configured in Azure Data Studio including keys, constraints, and indexes. For more information, see Overview of the table designer in Azure Data Studio.
  4. In SSMS, close the designer and specify a table name to save your changes. In Azure Data Studio, ensure the table name is updated in the Table name field, then select the Publish Changes icon, or close the designer and save the changes to create the table.

Update a table

  1. Right-click the table under the Tables node of your database and select Design.
  2. Update the desired table settings.
  3. Close the designer and save your changes, or use the Publish Changes icon in Azure Data Studio.

Permissions

In order to create a table, you must have CREATE TABLE permissions in the database and ALTER permission on the schema in which the table is being created. For more information, see CREATE TABLE (Transact-SQL).

To alter a table, you must have ALTER permissions on the table. For more information, see ALTER TABLE (Transact-SQL).