Create a New Table

Create a New Table

How do I create a new table?

The DLL syntax for creating a table intuitively is the CREATE TABLE command. You can specify all the options for the table that you can in Enterprise Manager, such as IDENTITY columns, primary keys, check constraints, default constraints and foreign keys.

Here’s a SQL code snippet that creates a table (and for more on the CREATE TABLE syntax check the SQL Server BOL):

CREATE TABLE TestTable(      ID  int    IDENTITY(1,1)    PRIMARY KEY CLUSTERED,  TestDescription varchar(50) NOT NULL,  Mileage tinyint NULL)


Share the Post: