devxlogo

Create a New Table

Create a New Table

Question:
How do I create a new table?

Answer:
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)

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist