Learn T-SQL Commands with Samples
Skip Navigation Links
Skip Navigation Links.
Expand DatabaseDatabase
Collapse TableTable
Expand ViewView
Expand Stored ProcedureStored Procedure
Expand Data FilteringData Filtering
Expand Data GroupingData Grouping
Expand JoinsJoins
Expand TriggerTrigger
Expand CursorCursor
Expand OperatorsOperators
Expand ConstraintsConstraints
Expand FunctionsFunctions
Expand Conditional ProcessingConditional Processing
Expand LoopingLooping
Expand Error HandlingError Handling
Expand v.IMP Queriesv.IMP Queries
Expand XMLXML
Expand Query PerformanceQuery Performance
Expand QueriesQueries
Expand NormalizationNormalization
Expand CreateCreate
     

Create Table

 
      USE myDB
      GO

      
---- Drop Table if it already exists
IF OBJECT_ID('dbo.sample_table', 'U') IS NOT NULL DROP TABLE dbo.myTable GO
---- Create Table
CREATE TABLE dbo.myTable ( ID int NOT NULL, Name char(23) NULL, DOB datetime NULL, CONSTRAINT PK_myTable PRIMARY KEY (ID) ) GO