sql database common several data types

1 . Character data :
char \ VARCHAR \ text
which is used to hold several types of data string
char data fixed length storage
varcahr store data by variable-length
text used when you need to store a very large number of strings
nchar, nvarchar , ntext
these strings is stored, corresponding to the same as above. The only difference is that these three types, is the use of Unicode encoding is used when you do an international website

2. Date Time data type
datetime, smalldatetime
are used to store the date and time information
datetime: Storage 1/1 / 1753- 12/31/9999 time data, accurate to 0.001s
smalldatetime: storing 1/1 / 1900-6 / 6/2079 time, accurate to the second

3. the integer data type
used to store an integer
BIGINT, int, smallint the, tinyint

BIGINT from -2 ^ 63 (-9223372036854775808) to 2 ^ 63-1 (9223372036854775807) integer data (all numbers).

int from -2 ^ 31 (2,147,483,648) to 2 ^ 31--1 (2,147,483,647) integer data (all numbers).

from -2 ^ 15 ^ smallint The 15 (-32,768) through 2--1 (32,767) integer data.

tinyint data integer from 0 to 255.

4. The exact decimal data type
for storing a decimal
decimal, numeric

5. The approximate value of the type
used to store the approximate number of
a float, Real

6. The Currency data type
used to store money data
money, smallmoney
to be added in front of data input currency currency symbol, if it is negative, then add the currency symbol after symbol

7-bit type data
bit
that had just difficult to understand, I'll give you an analogy it. For instance, your table has a place of sex, sex and only two possibilities, not a man is female. Then you can put gender this column's data type is set bit. Similarly all cases can be used bit type data.

If you do not know what, you can see sql Books Online.

Guess you like

Origin www.cnblogs.com/fw282204258/p/10948014.html