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)

devx-admin

Share the Post: