In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about what the data types in the database contain. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1, binary data nary fixed length binary data type
Binary [(n)] represents fixed-length n-byte binary data.
N must range from 1 to 8, 000, and the storage space size must be 4 bytes
Varbinary variable-length binary data types
Varbinary [(n)] represents n bytes of variable-length binary data.
N must be from 1 to 8000. The storage space is + 4 bytes of the actual input data length.
Instead of n bytes. The length of the data entered may be 0 bytes
Bp_w_picpath can be used to store variable length binary data exceeding 8 KB
Such as Microsoft Word documents, Microsoft Excel spreadsheets, images containing bitmaps, GIF files, and JPEG files
2: character data
Char fixed-length character data type. Char [(n)] represents fixed-length, non-Unicode character data with a length of n bytes.
N must be a number between 1 and 8000. Storage size is n bytes
Varchar is a non-fixed-length character data type.
Varchar [(n)] represents character data of variable length and not Unicode in length of n bytes. N must be a number between 1 and 8000.
The storage size is the actual length of the bytes of the input data, not n bytes. The length of the data characters entered can be 0
Columns of the text data type can be used to store ASCII characters larger than 8KB.
For example, because HTML documents are made up of ASCII characters and are generally longer than 8KB, you should store them in the text column in SQL Server before viewing them in a browser
3:unicode (Unicode Universal Code single Code) data
Nchar nchar is the data type of fixed-length Unicode data
Nchar (n) represents fixed-length Unicode character data containing n characters. The value of n must be between 1 and 4 000. The storage size is twice the size of n bytes
Nvarchar nvarchar is the data type of variable length Unicode data
Nvarchar (n) represents variable length Unicode character data containing n characters.
The value of n must be between 1 and 4 000. The storage size of bytes is twice the number of characters entered. The length of the data characters entered can be zero.
The maximum length of ntext variable length Unicode data is 2301 (1,073,741,823) characters. The storage size is twice the number of characters entered (in bytes)
4: time data and date data
Date and time data for datetime from January 1, 1753 to December 31, 9999
Accuracy is 3% seconds (equal to 3.33ms or 0.00333 seconds)
Smalldatetime's date and time data from January 1, 1900 to June 6, 2079 are accurate to minutes.
Smalldatetime values of 29.998 seconds or less are rounded down to the nearest minute, and smalldatetime values of 29.999 seconds or higher are rounded up to the nearest minute
5: digital data
(1) Integer:
Bigint integer data (all digits) from-263 (- 9 223 372 036 854 775 808) to 263-1 (9 223 372 036 854 775 807)
. The storage size is 8 bytes
Int integer data (all numbers) from-231 (- 2147483 648) to 231-1 (2147483647). The storage size is 4 bytes
Smallint integer data from-215 (- 32768) to 215-1 (32767). The storage size is 2 bytes.
Integer data with tinyint from 0 to 255. Storage size is 1 byte
(2) Decimal:
Decimal and numeric numeric data types with fixed-point precision and decimal places.
Decimal [(p [, s])] and numeric [(p [, s])] represent fixed-point precision and decimal places.
When maximum precision is used, valid values range from-1038 + 1 to 1038-1. P represents precision and specifies the maximum number of decimal digits that can be stored on the left and right side of the decimal point.
Precision must be a value from 1 to maximum precision. The maximum accuracy is 38. S represents the number of decimal places and specifies the maximum number of decimal digits that can be stored to the right of the decimal point.
The number of decimal places must be from 0 to p. The default number of decimal places is 0, so 0 ≤ s ≤ p The maximum storage size varies based on precision.
(3) the number of myopia
Float [(n)] floating-point digital data from-1.79E + 308 to 1.79E + 308.
N is the number of digits used to store the Mantissa of float in scientific notation, indicating its precision and storage size. N must be a value from 1 to 53.
Real floating-point digital data from-3.40E + 38 to 3.40E + 38. The storage size is 4 bytes
6: monetary data
Money currency data values range from-263 (- 922,337,203,685 477.5808) to 263-1.
(+ 922 337 203 685 477.5807), accurate to 10/1000 of the monetary unit. The storage size is 8 bytes
Smallmoney currency data values range from-214 748.3648 to + 214 748.3647, accurate to 10/1000 of the monetary unit. The storage size is 4 bytes
7: special data
Table is a special data type that stores the result set for later processing.
Table data types can only be used to define local variables of type table or return values of user-defined functions
The bit bit data type can only include 0 or 1. You can use the bit data type to represent TRUE or FALSE, YES, or NO.
For example, a question asking a customer if this is a first-time access can be stored in a bit column, similar to a Boolean in other data types
Timestamp is used to indicate the order in which SQL Server is active on a line, expressed in binary format as an increasing number.
When the rows in the table change, the timestamp is updated with the timestamp value of the current database obtained from the @ @ DBTS function.
Timestamp data is independent of the date and time when the data was inserted or modified. To automatically record when the data in the table changes
Use datetime or smalldatetime data types to log events or triggers
Uniqueidentifier represents a globally unique identifier (GUID) as a 16-bit hexadecimal number
. Use GUID when you need to uniquely identify a row in multiple lines.
For example, you can use the uniqueidentifier data type to define a customer identification code column to edit the company's overall customer directory from multiple countries
Sql_variant A storage SQL
Thank you for reading! This is the end of the article on "what are the data types in the database". I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.