In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article shows you the confusing data types in SQL SERVER, which are concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
(1) char, varchar, text and nchar, nvarchar, ntext
Char and varchar are both between 1 and 8000 in length. The difference between them is that char is fixed-length character data, while varchar is variable-length character data. The so-called fixed length means that the length of the input data is fixed, and when the input data length does not reach the specified length, it will be automatically filled with English spaces to make the length reach the corresponding length, while variable length character data will not be filled with spaces. Text stores variable length non-Unicode data with a maximum length of 2 ^ 31-1 (2147483647) characters.
Compared with the previous one, the last three data types only have an extra letter "n" in terms of name, which indicates that characters of the Unicode data type are stored. Friends who have written programs should know a lot about Unicode. Among the characters, only one byte is enough to store English characters, but there are many Chinese characters that need two bytes of storage. It is easy to cause confusion when English and Chinese characters exist at the same time. The Unicode character set is created to solve the incompatible problem of the character set. All its characters are represented by two bytes, that is, English characters are also represented by two bytes. The length of nchar and nvarchar is between 1 and 4000. Compared with char and varchar, nchar and nvarchar can store up to 4000 characters, whether in English or Chinese characters, while char and varchar can store up to 8000 English characters and 4000 Chinese characters. You can see that when using nchar and nvarchar data types, you don't have to worry about whether the input characters are English or Chinese characters, which is more convenient, but there is some loss in the quantity when storing English.
(2) datetime and smalldatetime
Datetime: date and time data from January 1, 1753 to December 31, 9999, accurate to 3% seconds.
Smalldatetime: date and time data from January 1, 1900 to June 6, 2079, 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 (- 2147483648) to 2 ^ 31-1 (2147483647).
Smallint: integer data from-2 ^ 15 (- 32768) to 2 ^ 15-1 (32767).
Tinyint: integer data from 0 to 255.
Integer data for bit:1 or 0.
(4) decimal and numeric
The two data types are equivalent. Both have two parameters: P (precision) and s (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 between 1 and 38. S specifies the maximum number of decimal digits that can be stored to the right of the decimal point. S must be a value from 0 to p, and the default number of decimal places is 0.
(5) float and real
Float: floating point numeric data from-1.79 ^ 308 to 1.79 ^ 308.
Real: floating point numeric data from-3.40 ^ 38 to 3.40 ^ 38. In SQL Server, real is synonymous with float (24).
The above are the confusing data types in SQL SERVER. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.