Example of create table syntax in sql server

 128 Total Views,  2 views today

What is Table:
Tables are used to store data in the database.
Tables name are unique within a database and schema. It contain one or more columns.
A table can have up to 1,024 columns (with the exception of sparse columns) but can’t exceed a total
of 8,060 actual used bytes per row.

Below is the create table statement:

CREATE TABLE Employee(
[EmployeeID] [int] IDENTITY(1,1) NOT NULL,
[NationalIDNumber] nvarchar NOT NULL,
[ContactID] [int] NOT NULL,
[LoginID] varchar NOT NULL,
[ManagerID] [int] NULL,
[Title] nvarchar NOT NULL,
[BirthDate] [datetime] NOT NULL,
[MaritalStatus] nchar NOT NULL,
[Gender] char NOT NULL,
[HireDate] [datetime] NOT NULL,
[SalariedFlag] [dbo].[Flag] NOT NULL,
[VacationHours] [smallint] NOT NULL,
[SickLeaveHours] [smallint] NOT NULL,
[ModifiedDate] [datetime] NOT NULL,
CONSTRAINT [PK_Employee_EmployeeID] PRIMARY KEY CLUSTERED
([EmployeeID]));

see also:
https://www.databaseblogs.com/rename-table-sql-server/

insert data into tables:

also see

Leave a Reply

Your email address will not be published. Required fields are marked *