Data type in SQL2000

xiaoxiao2021-03-06  102

Recently, in doing database design, sometimes you can't get the data type in SQL2000, so this article will be taken.

(1) CHAR, VARCHAR, TEXT and NCHAR, NVARCHAR, NTEXTCHAR and VARCHAR are between 1 and 8000, and their difference is that char is a fixed length character data, while Varchar is a growing character data. The so-called fixed length is fixed, and when the input data length does not reach the specified length, it will automatically fill the length behind it, so that the length reaches the corresponding length; the length character data will not fill in space. TEXT stores a variable length non-Unicode data with a maximum length of 2 ^ 31-1 (2, 147, 483, 647) characters.

The latter data type is compared with the front, from the name only, only a letter "N", which indicates the character stored in the Unicode data type. Friends who wrote the program should be very understandable to Unicode. In characters, English characters only need one byte storage is enough, but there are many Chinese characters, need two byte storage, and the English and Chinese characters are easily confusing, and the Unicode character set is to solve this incompatible problem for the character set. The result is generated, and all characters are represented by two bytes, ie the English characters are also represented by two bytes. Nchar, NVARCHAR length is between 1 and 4000. And char, varchar comparison: nchar, NVARCHAR will store up to 4000 characters, whether it is English or Chinese characters; while char, varchar can store up to 8,000 English, 4000 Chinese characters. It can be seen that the characters that do not have to worry about the input when using nchar, NVARCHAR data types, which is more convenient, but some loss in the number of English in English.

(2) DateTime and SmallDatetimeDatetime: Date and time data from January 1, 1999 to December 31, 999, exactly three minutes. SmallDatetime: Date and time data from January 1, 2079, January 6, 2079, accurate to minutes.

(3) Bitint, Int, Smallint, Tinyint and Bitbigint: The integer data from -2 ^ 63 (-92233720368547758) to 2 ^ 63-1 (9223372036854775807). INT: An 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: from 0 to 255 integer data. Bit: 1 or 0 integer data.

(4) The two data types of Decimal and Numeric are equivalent. There are two parameters: p (precision) and S (decimal number). p Specifies the maximum number of decimal numbers that can be stored on the left and right side of the decimal point, and P must be a value between 1 and 38. s Specifies the maximum number of decimal numbers that can be stored on the right side of the decimal point, and s must be a value between 0 to P, the default decimal number is 0.

(5) Float and Realfloat: floating point digital data between -1.79 ^ 308 to 1.79 ^ 308. REAL: from -3.40 ^ 38 to 3.40 ^ 38 floating point digital data. In SQL Server, the synonym of Real is FLOAT (24).

转载请注明原文地址:https://www.9cbs.com/read-103415.html

New Post(0)