(1)Char, varchar, text, nchar, nvarchar, ntext Char The length of a varchar is between 1 and 8000. The difference between them is that char is a fixed-length character data, and varchar is a variable-length character data. The so-called fixed length is fixed length, when the input When the data length does not reach the specified length, it is automatically filled with spaces behind it to make the length reach the corresponding length, while the variable length data is not filled with spaces. Text stores variable-length non- Unicode data. The maximum length is 2 ^ 31-1 (2,147,483,647) characters. Compared with the preceding three data types, the names only contain letters "N", which indicate that the characters of the Unicode data type are stored. WrittenProgramFriends of Unicode should This is a good idea. Only one byte is required for English characters, but there are many Chinese characters and two bytes are required for storage. It is easy to cause confusion when both English and Chinese characters exist. The Unicode Character Set is Solved the incompatibility problem of character sets. All its characters are expressed in two bytes, that is, English characters are also expressed in two bytes. The length of nchar and nvarchar is from 1 In the range of 4000. Compared with Char and varchar, nchar and nvarchar can store a maximum of 4000 characters, whether in English or Chinese characters, Varchar can store up to 8000 English letters and 4000 Chinese characters. We can see that when using the nchar and nvarchar data types, you do not have to worry about whether the entered characters are English or Chinese characters. Convenience, but there is some loss in the amount of stored English hours. (2)Datetime and smalldatetime Datetime: Date and Time data from January 1, 3% to seconds. Smalldatetime: Date and Time data from January 1, January 1-20, 1900 to January 1, June 6, accurate to minutes. (3)Bitint, Int, smallint, tinyint, and bit Bigint: integer data from-2 ^ 63 (-9223372036854775808) to 2 ^ 63-1 (9223372036854775807. INT: integer data from-2 ^ 31 (-2,147,483,648) to 2 ^ 31-1 (2,147,483,647. Smallint: integer data from-2 ^ 15 (-32,768) to 2 ^ 15-1 (32,767. Tinyint: integer data from 0 to 255. Bit: an integer of 1 or 0. (4)Decimal and numeric The two data types are equivalent. There are two parameters: P (precision) and S (number of decimal places ). P specifies the maximum number of decimal digits that can be stored on the left and right of the decimal point. P must be a value ranging from 1 to 38. S specifies the maximum number of decimal digits that can be stored on the right of the decimal point. s must be a value ranging from 0 to P. The default decimal place is 0. (5)Float and real Float: floating point data from-1.79 ^ 308 to 1.79 ^ 308. Real: floating point data from-3.40 ^ 38 to 3.40 ^ 38. In SQL Server, the synonym for real is float (24 ). |