SQL Server tables
type of table:① Temporary table
Temporary tables can be used to process intermediate data or to use temporary tables
Share the work in progress with other connections. Temporary tables only
Can be placed in tempdb.
Private Temp Table (#)Global Temp Table (# #) ② system table
Used to store all database objects, data types, constraints,
A table of information related to configuration options.
The data type of the property
1. Basic Data type:① exact numeric type② Approximate number types③unicode Character Types④ binary Type⑤ Date and Time type⑥ String Typeother2. User-defined data types:① The name of the data typesystem built-in data types based on ②whether the ③ is allowed to be emptyyou can use system stored procedures to manage your custom data types
sp_addtype [@typename =] type,
[@phystype =] System_data_type
[], [@nulltype =] ' null_type '
For example: sp_addtype phone1, 'char (one)','notnull'
to delete a custom data type by using a system stored procedure
For example: Sp_droptype phone1
Create a data table
1. Create with Sqlsms2. Using SQL statements to create
CREATE TABLE Tabel_name
(Colomn_name data_type
[Identity [(Seed,increment)]
[<colunm_constraint>]])
For example:
1 Create TableSC (2SnoChar(5),3CnoChar(3),4Gradeint Check(Grade>=0 andGrade<= -),5 Primary Key(SNO,CNO)6)
Modify Table
1. Modify the table name① renaming with Sqlsms② using system stored procedures
sp_rename [@objname =] ' object_name ', [@newname =] ' new_name '
For example : sp_rename 'sc',' elective course '
2. Modifying the properties of a table3. Attribute Columns① modifying, adding, and deleting columns in the Table Designer ② use T-SQL statements to modify and delete columns, such as
alter table elective add grade1 int
alter table elective drop column grade1
Delete a table
1. Delete with sqlsms 2. Delete using SQL statement
Example: drop table Elective course
SQL Server 2008 Operational Data Sheet