SQL Server data types
Transact-SQL ———— database programming language
One or two binary data binary data is stored in 16 binary form.
Format: 1, binary (n) ———— a fixed-length n-byte binary data, n means that the length of the data is 1~8000, the input data must be in the data before the ox as a binary identity.
2, varbinary (n) ———— custom n-byte variable-length binary data
Ox24 ———— Where: Ox is a hexadecimal type, 24 is hexadecimal data
Character data char (n) ———— character data type with a fixed length of n (1-8000), n represents the occupied storage space
Nchar (n) ———— length 1-4000, with N for Unicode standard character set, infrequently used
Three, String type
varchar (n) ———— a string type with a maximum length of n (1-8000) for a variable length. Save a few characters, such as name, login, password, etc., but no item can be longer than 8KB
Nvarchar (N)
Nvarchar (max) ———— Custom size, can change size does not contain string four, datetime type: Fixed length of data type
Time (N) ———— a 24-hour system, with only a few seconds, the greater the value in parentheses, the higher the precision of the second.
DateTime (N) ———— 24-hour datetime
DateTime ———— 1753-1-1 00:00:00 to A.D. 9999-12-31 23:59:59 smalldatetime
Datetimeofset ———— Date and time type with time zone
Five, shaping data types
bigint ———— (8B) ———— data per bigint type is 8 bytes (large integer)
int ———— (4B) ———— data for each int type is stored in 4 bytes, where 1 bits represent the sign of the integer value, and the other 31 bits represent the integer value length and size
smallint ———— (2B) ———— each smallint type of data is stored in 2 bytes, where 1 bits represent the sign of the integer value, and the other 15 bits represent the value length and size
tinyint ———— (1B)
Six, floating-point type
Real accurate to 7th decimal place, accounting for 4 bytes
Float ———— small precision, up to 15 decimal, accounting for 8 bytes
Decimal (p,s) ———— precision, accurate to four digits after the decimal point (p is the total number of digits is precision, S is the number of decimal places)
does not contain double
Boolean type (logical type)
Bit ———— byte type, only one byte can be placed, the value is 0 or 1, if the input other value will default to 1, cannot be defined as null.
does not contain bool
Viii. type of currency
Money ———— The type of stored number, which is a decimal value with four decimal places, 8 bytes, preceded by a currency symbol to differentiate the country, otherwise the default ¥
SmallMoney ———— Storage Currency range is small
Ix. type of text
The text ———— is used to store large text data of variable length, which can store 2GB
X. Image data Type
Image ———— in the database, to save the picture, try to save the picture path, do not store the picture directly
Xi. data types that are not commonly used
Geometry ———— geometry Geography ———— Map
12. Storage hierarchy (Relationship between table and table)
Herarchayid
13. XML:
A programming language for special writing rules that is designed to hold fixed data; in vs2012, the solution Manager has XML in config, configuration ———— store Some of the config information, parameters, etc.
SQL Server data types