Tags: style blog http color ar sp data div onLet's take a look at the SQL Server data type table, which lists the most common types: classification notes and description data type description binary data types store non-sub-characters and text dataImageuse to store image text data type character data includes any combi
Tags: The difference contains synchronous occurrences of blog writes. com eager wwwSource: IO-related wait types in SQL Server: Io_completion and pageiolatch_*A large SQL statement operation, the execution plan contains a merge join operation, observed that SQL long time in
: Integer data from 0 to 255.Bit:1 or 0 of integer data. (4) decimal and numericBoth of these data types are equivalent. have two parameters: P (Precision) and S (decimal digits). p Specifies the maximum number of decimal digits that can be stored to the left and right of the decimal point, and P must be a value from 1 to 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
up to 8000 English and 4000 Chinese characters. It can be seen that when using nchar and nvarchar data types, you do not have to worry about whether the entered characters are English or Chinese characters, which is more convenient, but there is some loss in the amount of stored English hours. 3. Text and ntext. Since SQL server stores data on data pages, each d
area char (%)
DECLARE @ contributor number of users CHAR (
declare @sql char)
declare cur_data cursor for
select CONVERT (varchar (10), due time,) as Expiration time, Slices, count (distinct main_id) as number of users from
V_aipu_fee where commit time >=convert (varchar), GETDATE () -90,120) and submit time
Next to introduce you to SQL use
Differences between varchar and nvarchar:
Varchar (N)Variable-length and non-UNICODE character data with a length of n Bytes. N must be a value between 1 and 8,000. The storage size is the actual length of the input data bytes, rather than n Bytes (such as varchar (6). When the field is qqq, the actual space occupied by the database is 3 bytes, instead of 6 bytes, it can only store 6 bytes. Generally, Chinese occupies two bytes ).
Nvarchar (N)Unicode data with a variable length of n characters.
The access and SQL server data types are different. These types are useful when you use scripts to define data.
Microsoft Access Data Type
SQL Server Data Type
Yes/No
Bit
Smallint (byte type)
T
In SQL Server, when we set character fields, there are often many data types for us to choose from, such as char nchar varchar nvarchar. Which one should we choose? The differences are described one by one.
Char:Fixed Length, non-Unicode character data, length is n Bytes. The value range of n is 1 to 8,000, and the storage size is n Bytes. The synonym for SQL2003
Tags: ima timestamp mon XML Hiera blog AC Div class
SQL Server data Types
Oracle data Types
bigint
Number (19,0)
Binary (1-2000)
RAW (1-2000)
Binary (2001-8000)
Blob
Bit
Number (1)
char (1-2000)
Several types of data commonly used in SQL Server:
Binary
Fixed-length binary data with a maximum length of 8,000 bytes.
varbinary
Variable-length binary data with a maximum length of 8,000 bytes.
Image
Variable-length binary data with a maximum length of 2g+-1 (2,147,483,647) bytes
Text
The maximum length of variable-length non-Unicode data in the
(-32,768) to 2^15-1 (32,767).
tinyint: Integer data from 0 to 255.
bit:1 or 0 of integer data.
(4) decimal and numeric
the two types of data are equivalent. have two parameters: P (Precision) and S (scale). p Specifies the maximum number of decimal digits that can be stored to the left and right of the decimal point, and P must be a value from 1 to 38. s specifies the maximum number of decimal digits that can be stored to the right of the de
).
Tinyint: Integer data from 0 to 255.
Bit:1 or 0 of integer data.
(4) decimal and numeric
The two types of data are equivalent. have two parameters: P (Precision) and S (scale). p Specifies the maximum number of decimal digits that can be stored to the left and right of the decimal point, and P must be a value from 1 to 38. s specifies the maximum number of decimal digits that can be stored to the right of the decimal point, and S must be a value
(-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:1 or 0 of integer data.
(4) Decimal and numeric
Both of these data types are equivalent. have two parameters: P (Precision) and S (decimal digits). p Specifies the maximum number of decimal digits that can be stored to the left and right of the decimal point, and P must be a value from 1 to 38. s specifi
Tags: style blog http color using AR strong data SPWe know that the datetime type in this SQL Server database is a data type that is often used in database application development, and the C # language also has a DateTime type, although both are used to describe time, but their default values are different, which must be noted in the development process , it is a waste of time to deal with the relationship
1. Type comparison
Bigint: integer data from-2 ^ 63 (-9223372036854775808) to 2 ^ 63-1 (9223372036854775807). The storage size is 8 bytes. One byte is 8 bits, so bigint has 64 bits
INT: integer data from-2 ^ 31 (-2,147,483,648) to 2 ^ 31-1 (2,147,483,647). The storage size is 4 bytes. Int type, which can store up to 32 bits of data
Smallint: integer data from-2 ^ 15 (-32,768) to 2 ^ 15-1 (32,767). The storage size is 2 bytes. Smallint has 16 digits.
Tinyint: integer data from 0 to 255. The s
SQL Server data typesTransact-SQL ———— database programming languageOne or two binary data binary data is stored in 16 binary form.Format: 1, binary (n) ———— a fixed-length n-byte binary data, n means that the length of the data is 1~8000, the input data must be in the data before the ox as a binary identity.2, varbinary (n) ———— custom n-byte variable-length bin
: 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 numericThe 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
data from 0 to 255.
Bit:1 or 0 of integer data.
(4) Decimal and numeric
The two types of data are equivalent. have two parameters: P (Precision) and S (scale). p Specifies the maximum number of decimal digits that can be stored to the left and right of the decimal point, and P must be a value from 1 to 38. s specifies the maximum number of decimal digits that can be stored to the right of the decimal point, and S must be a value between 0 and P, a
Common Data Types in SQL Server:
BinaryA fixed-length binary data with a maximum length of 8,000 bytes.
VarbinaryA variable-length binary data with a maximum length of 8,000 bytes.
ImageA variable-length binary data with a maximum length of 2G +-1 (2,147,483,647) bytes
TextServerCodeThe maximum length of non-Unicode data in the Variable Length page is 2G +
Common Data Types in SQL server:BinaryA fixed-length binary data with a maximum length of 8,000 bytes.VarbinaryA variable-length binary data with a maximum length of 8,000 bytes.ImageA variable-length binary data with a maximum length of 2G +-1 (2,147,483,647) bytesTextThe variable length of non-Unicode data in the server code page cannot exceed 2G + (2,147,483,6
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.