What is the type of integer 1000000 in sql. SQL real data type. Numeric data types

In this publication we will look at data types in SQL. I would like to draw your attention to the fact that different DBMSs support different sets of data types, so this publication includes the most common data types in the SQL implementations of various DBMSs.

It is important to know that in order to design databases correctly and competently, the correctly selected data type in SQL can greatly facilitate the work of other developers. Therefore, I do not advise you to skip the section on data types and always, when you get acquainted with a new one, pay attention to the data types that the program supports and how it processes these data types.

Let's look at the data types that exist in the SQL language. Each table column (attribute) must have a data type for the values ​​that are stored in the column. The data type for a column is determined when the table is created, or better yet, when it is determined during the .

SQL language divides data into five types:

  1. SQL integer data type.
  2. Real type SQL data.
  3. SQL date and time data types.
  4. SQL string data type.
  5. Unicode SQL string data type.

Let's see what each includes SQL data types and what values ​​they allow us to store.

Integer data typeSQL

Integer data type in SQL quite broad and depends on the implementation of the DBMS; below are only a few tables typical examples SQL integer data type.

SQL data type from before
bigint -9,223,372,036,854,775,808 9,223,372,036,854,775,807
int -2,147,483,648 2,147,483,647
smallint -32,768 32,767
tinyint 0 255
bit 0 1
decimal -10^38 +1 10^38 -1
numeric -10^38 +1 10^38 -1
money -922,337,203,685,477.5808 +922,337,203,685,477.5807
smallmoney -214,748.3648 +214,748.3647

Once again I repeat that the set of integers data types in SQL depends entirely on the DBMS.

Real data typeSQL

SQL real data type, like the integer data type, is entirely dependent on the DBMS implementation.

String data typeSQL

There can be many more string data types in SQL; see the specification of your DBMS to find out what data type can be used for string values.

SQL data type Description
char Maximum length is 8000 characters (all values ​​in the column have a fixed size specified when the column is declared). Please note: unit of measurement SQL data type char- symbol.
varchar Maximum length is 8000 characters (all values ​​in the column are different size depending on the number of characters, but not more than the size that was specified when declaring the column). Please note: unit of measurement SQL data type varchar- symbol.
varchar(max) SQL data type varchar(max)- symbol.
text Maximum length 2,147,483,647 characters. Please note: unit of measurement SQL data type text- symbol.

Unicode SQL string data type

Yes, some DBMSs allocate a string data type in Unicode encoding, since in Unicode encoded strings at least 8 bytes are spent on writing one character, which is why we allocate string data type in SQL with unicode encoding.

SQL data type Description
nchar Maximum length is 4000 characters (all values ​​in the column have a fixed size specified when the column is declared). Please note: unit of measurement SQL data type nchar- symbol.
nvarchar The maximum length is 4000 characters (all values ​​in the column have a different size depending on the number of characters, but no more than the size specified when the column was declared). Please note: unit of measurement SQL data type nvarchar- symbol.
nvarchar(max) Maximum length 231 characters. Please note: unit of measurement SQL data type nvarchar(max)- symbol.
ntext Maximum length 1,073,741,823 characters. Variable length. Please note: unit of measurement SQL data type ntext- symbol.

Binary data type inSQL

Binary data type in SQL used to store information in binary form(as a sequence of bytes).

SQL data type Description
binary Maximum length is 8,000 bytes (all values ​​in the column have a fixed size specified when the column is declared). Please note: the units of the binary data type are bytes.
varbinary Maximum length is 8,000 bytes (all values ​​in the column have a different size depending on the number of characters, but no more than the size specified when the column was declared). Please note that the units of the varbinary data type are bytes.
varbinary(max) Maximum length 231 bytes. Note that the units of the varbinary (max) data type are bytes.
image Maximum length is 2,147,483,647 bytes (all values ​​in the column have a different size depending on the number of characters, but no more than the size specified when the column was declared). Please note: the units of the image data type are bytes.

I would like to draw your attention to the fact that each DBMS supports its own set of data types and dimensions; we looked at the basic data types of the SQL language, in next topic We'll look at the data types that SQLite3 supports.

Signed and unsigned data types in SQL

I would like to draw your attention to the fact that in some DBMSs, numeric data types can be divided into signed and unsigned data types. And it's perfect different types data.

For example, if you store id INTEGER UNSIGNED in one table, and id_table1 INTEGER SIGNED in another, then you will not be able to implement these two columns, since they have different data types. Be careful and always read data type descriptions when you start using a new DBMS.

Let's give an example practical application SIGNED and UNSIGNED data types. For example, MySQL has the TINYINT data type, which takes up one byte and is great for storing age, so a TINYINT column can store integers from 0 to 256 (two to the eighth power, one byte has 8 bits, and one bit can take two values: zero or one), if the column is unsigned, if the column is signed, then numbers from -128 to 127 can be written into it (one bit will go per sign).

IN modern world there are a large number of means and technologies intended for storing information. One of the most common methods is databases, which are used to work with various systems management. This method storage assumes that all data is clearly structured and entered into special tables. They, in turn, consist of attribute columns of a certain data type.

Data type - what is it?

Today, there are several definitions that explain the concept of the term “data type”. However, each of them has one general meaning. Therefore, it can be conventionally defined as a group of data characterized by its values ​​(symbolic, numeric, etc.), as well as the operations applied to the values ​​in question.

The scope of application of data types is multifaceted. They are used not only for storing information, but also in programming to solve various tasks. When designing programs, it is a common practice to develop and use own types data from a certain set operations. However, custom ones are always based on basic data types. The SQL standard is also based on the use of the most common basic types, but with a number of specific additions.

Classification of data types

Grouping data by type arose a long time ago and was caused by the need for more convenient processing. Currently the basis existing types There are two types of data: symbolic and numeric.

Based on them, it was developed modern classification, which includes pointer, boolean, integer, float, and string data types. SQL - the classification fully covers all of the above. However, for some modern DBMSs there are additional add-ons. These include Oracle and MySQL.

Basic Data Types

Those used to create table attributes that meet language standards are divided into 4 classes:

  • string values;
  • fractions;
  • integer values;
  • date and time values.

String data type

The first group of values ​​allows you to store any data represented as characters.

It can be Special symbols, numbers and letters, which together will be processed as strings in any Data types, the table listing which is presented below, form the first group.

Used to store strings. The parameter in brackets allows you to fix the length of the stored string. Maximum size in bytes that can be set for a string is 255.

Similar to the previous type, it allows you to store strings up to 255 characters long. However, the difference from CHAR is that the required amount of memory is allocated to store a value of this type. That is, a string consisting of 5 characters will require 6 bytes of memory. In the first case, memory for the value will be allocated according to the specified parameter.

Used to store string data up to 255 characters.

Used to store text information whose size does not exceed 65,535 letters.

The data type in question is similar to the TEXT type and allows you to save it in the database text information, the volume of which can reach 65,535 characters. But in practice it is used to store sound data, drawings, electronic documentation, etc.

It was developed on the basis of the TEXT type, but allows you to store more data due to the increased size up to 16,777,215 letters or symbols.

Used to save to the database electronic documents, the size of which does not exceed 16,777,215 characters.

Functionally similar to previous types, but with increased memory capacity up to 4 gigabytes.

Allows you to place large amounts of data into the database (4,294,967,295 characters).

ENUM (a, b, c, etc.)

A special data type used to specify a list of possible values. Allows you to specify 65535 values. Strings of the type in question can take a single value from those specified in the set. In the case where values ​​will be added that are not present in given list, empty values ​​will be written to the table.

Specifies a set acceptable values. Unlike previous type, is used to hold 64 parameters that can be initialized by any or more of the given arguments.

Fractional data types table

Fractional SQL data types are used to store floating point numbers. In practice, as a rule, various financial indicators are set. Depending on the required accuracy, one of the three presented is used:

For example, in banking calculations the accuracy of the fractional part reaches 8 or 10 digits. The first two types cannot be used in this area.

Storing financial indicators in the form of strings greatly simplifies the solution of many problems. However, when dealing with financial issues or performing various SQL operations, data type conversion is of great importance. Developers must be sure to consider the type of storage and processing methods to ensure that the data always remains unchanged.

Integer data type

Whole numbers - separate group numbers, forming one of the main classes. Integer SQL data types are based on the use of a base one with some extension of its properties.

By selecting correct type data, you can significantly save memory and reduce the cost of server time when the necessary SQL queries are executed. The types of data, or rather their range, determine the amount of storage space required.

Therefore, it is important for developers to remember that using large ranges for attributes entails increased memory costs. It is necessary to clearly analyze the problems being solved and identify cases where the approximate range is known and the condition for using signed numbers is defined. If the range of arguments used is small and all numbers are positive, then it would be more correct to use the unsigned type formed by the UNSIGNED attribute.

Date and Time Data Types

When studying SQL Basics The date and time data types are of particular interest.

Using the types below provides additional benefits when developing systems whose operation depends on time parameters.

The main purpose is to store the date in the format YEAR-MONTH-DAY (“YYYY-MM-DD” or “uuuu-mm-dd”). Typically, values ​​are separated by “-”, but any character except numbers can be used as a separator.

Allows you to enter temporary values ​​into a table cell. All values ​​are specified in the format “hh:mm:ss”

Combines the functions of the previous two types. The storage format is presented as follows: “uuuu-mm-dd hh:mm:ss”.

Stores the date and time, calculated by the number of seconds that have passed since midnight on January 1, 1970, until the specified value.

Used to store annual values ​​in two or four digit format.

What else do you need to know?

All these data types are systematized in detail by Microsoft. She developed SQL data types in more detail.

For example, the company describes in detail how much memory in bytes is allocated when using each type. Having studied the available information, it is easier for developers to design the structure of tables and the entire database based on the hardware capabilities of the server.

Special pointer - NULL

Sometimes, when populating a database, a situation arises when, when adding a record to a table, there is no need to enter information into all columns. For this purpose it is used special index empty value - NULL, which as aid uses SQL language. When tables are created, the data types of columns that are not required to be filled in are specified with a statement that allows the inclusion of null values. In another case, the operator NULL With additional attachment NOT can be used to indicate mandatory filling all values.

Pointer NULL has no type, but simply points to an empty value in database tables. Therefore, it can be combined with any of the above types.

For each column, in addition to the unique column name within the table, it is also necessary to determine the data type. Assigning a data type to each column is one of the first steps taken when designing a table. Data types define the valid data values ​​for each column.

2.3.1 Types char and varchar.

They are character data types of fixed or variable length.

char[(n)] is fixed-length, non-Unicode character data with a length of n bytes. The value of n must be between 1 and 8000. The storage size of this data type is n bytes. The ISO synonym for char is character.

varchar [ (n | max) ] - variable-length character data, not in Unicode; n can have a value from 1 to 8,000; max means the maximum storage size is 2^31-1 bytes. The storage size is equal to the actual data length plus two bytes. The entered data can be 0 characters long. ISO synonyms for the varchar type are char varying or character varying.

char or varchar data can be a single character or a string maximum length of 8000 characters for char data and up to 2^31 characters for varchar data.

varchar data types can take two forms. varchar data can be of a specified maximum length in characters, for example varchar(6) indicates that the data type can store a maximum of six characters, or it can be varchar(max), which increases the maximum number of characters that can be stored in the type data, up to 2^31.

Character constants must be enclosed in single (") or double quotes("). It is recommended to enclose character constants in single quotes. Enclosing character constants in double quotes is sometimes not allowed when QUOTED IDENTIFIER is set to ON.

This Transact-SQL code example assigns a value to a character variable:

DECLARE @MyCharVar CHAR(25)

SET @MyCharVar = "Ricardo Adocicados"

If you use single quotes to delineate a character constant that contains a nested single quote, use two single quotes to represent the nested single quote.

For example:

SET @MyCharVar = "O""Leary"

If the data to be stored is longer than valid number characters, they are truncated. For example, if a column is defined as char(10) and stores the value "This is a really, really long character string," then SQL Server truncates the character string to "This is a valid."

The char data type becomes a fixed-length data type if the NOT NULL clause is specified. If a value shorter than the column length is inserted into a char column with a NOT NULL clause, that value is right-padded with spaces to the size of the column. For example, if a column is defined as char(10) and the value "music" is to be stored in it, SQL Server stores data in the form "music____", where "_" represents a space.

2.3.2 Data types nchar and nvarchar.

These are constant-length (nchar) or variable-length (nvarchar) character data types containing Unicode data and using the UCS-2 character set.

nchar [(n)] - Unicode character data of n characters long. n must be a value between 1 and 4000. The storage size is twice n bytes. ISO synonyms for the nchar type are national char and national character.

nvarchar [ (n | max) ] - Variable-length Unicode character data. n can be a value from 1 to 4,000. max specifies that the maximum storage size is 2^31-1 (2,147,483,647) bytes. The storage size in bytes is twice the number of characters entered + 2 bytes. The entered data can be 0 characters long. ISO synonyms for the nvarchar type are national char varying and national character varying.

DEFINITION OF DATA STRUCTURE

Questions:

1. SQL data types defined by the standard... 1

2. Data types used in the SQL server. 3

3. Expressions and variables. 5

4. Managers SQL constructs.. 6

5. Basic objects of the SQL server database structure. 7

SQL data types defined by the standard

Data– this is aggregate information stored in a database in the form of one of several various types. Data types define the ground rules for the data contained in a particular table column, including the amount of memory allocated for it.

SQL has six scalar data types defined by the standard. Their short description presented in the table.

Character data

Character data consists of a sequence of characters included in a set of characters defined by the creators of the DBMS. Because character sets are specific to different dialects of the SQL language, the list of characters that can be included in character data values ​​is also implementation-specific. The most commonly used sets ASCII characters and EBCDIC. To define character type data, use next format:

<символьный_тип>::=

( CHARACTER [ VARYING][length] | [length])

When defining a column with a character data type, the length parameter is used to specify the maximum number of characters that can be placed in this column(default value is 1). Character string may be defined as having a fixed or VARYING length. If a string is defined with a fixed length of values, then when fewer characters are entered into it, the value is padded to the specified length with spaces added to the right. If a string is defined with a variable length value, then if you enter fewer characters into it, only the entered characters will be stored in the database, which will allow you to achieve some savings external memory.

Bit data

Bit type data is used to define bit strings, i.e. sequences binary digits(bits), each of which can have the value either 0 or 1. Bit type data is defined using the following format:

<битовый_тип>::=

BIT [length]

Exact numbers

Exact numeric data type used to determine numbers that have an exact representation, i.e. numbers consist of digits, an optional decimal point, and an optional sign character. Exact numeric type data is determined by the precision and length of the fractional part. Precision specifies the total number of significant decimal digits of a number, which includes the length of both the integer and fractional parts, but excluding the decimal point itself. The scale indicates the number of fractional decimal places of a number.

<фиксированный_тип>::=

(NUMERIC[accuracy[,scale]]|(DECIMAL|DEC)

[precision[, scale]]

| (INTEGER |INT)| SMALLINT)

Types NUMERIC And DECIMAL are designed to store numbers in decimal format. By default, the length of the fractional part is zero, and the default precision is implementation dependent. The INTEGER (INT) type is used to store large positive or negative integers. SMALLINT type – for storing small positive or negative integers; in this case, external memory consumption is significantly reduced.

Rounded numbers

Type of rounded numbers used to describe data that cannot be accurately represented in a computer, in particular real numbers. Rounded or floating point numbers are represented in scientific notation, in which the number is written using the mantissa multiplied by a certain degree ten (order), for example: 10E3, +5.2E6, -0.2E-4. To define data of a real type, the following format is used:

<вещественный_тип>::=

( FLOAT [precision] | REAL |

DOUBLE PRECISION)

Parameter accuracy specifies the number of significant digits of the mantissa. The precision of the REAL and DOUBLE PRECISION types is implementation dependent.

date and time

Date/Time data type used to determine points in time with some specified accuracy. SQL standard supports the following format:

<тип_даты/времени>::=

(DATE | TIME[precision]|

TIMESTAMP[precision])

The DATE data type is used to store calendar dates that include YEAR, MONTH, and DAY fields. The TIME data type is for storing timestamps, including the HOUR (hours), MINUTE (minutes) and SECOND (seconds) fields. TIMESTAMP data type – for storing date and time together. The precision parameter specifies the number of fractional decimal places that determine the precision of storing the value in the SECOND field. If this parameter is omitted, it defaults to columns TIME type accepted equal to zero(i.e. whole seconds are stored), whereas for fields of type TIMESTAMP it is assumed to be 6. Availability keyword WITH TIME ZONE specifies the use of the TIMEZONE HOUR and TIMEZONE MINUTE fields, thereby specifying the hour and minutes of the zone time offset in relation to Universal Coordinated Time (Greenwich Time).

INTERVAL data is used to represent time periods.

Domain concept

Domain is a set of valid values ​​for one or more attributes. If a database table or multiple tables have columns that have the same characteristics, you can describe the type of that column and its behavior through a domain, and then assign each one identical columns domain name. The domain defines all potential values ​​that can be assigned to an attribute.

The SQL standard allows you to define a domain using the following statement:

<определение_домена>::=

CREATE DOMAIN domain_name

data_type

[DEFAULT value]

[CHECK (valid_values)]

Each domain that is created is assigned a name, a data type, a default value, and a set of allowed values. It should be noted that the given statement format is incomplete. Now, when creating a table, you can specify a domain name instead of a data type.

Removing domains from the database is done using the statement:

DROP DOMAIN domain_name [ RESTRICT |

If you specify the CASCADE keyword, any table columns created using the domain being deleted will be automatically modified and described as containing data of the type that was specified in the definition of the domain being deleted.

An alternative to domains in SQL environment Server are custom types data.

Data types used in SQL server

System data types

One of the main points of the table creation process is determining the data types for its fields. The data type of a table field determines the type of information that will be placed in that field. The concept of a data type in SQL Server is completely equivalent to the concept of a data type in modern languages programming. SQL server supports big number various data types: text, numeric, binary (see table).

Let's give short review SQL Server data types.

Used to store symbolic information character data types, which include CHAR (length), VARCHAR (length), NCHAR (length), NVARCHAR (length). The last two are for storing Unicode characters. The maximum length is limited to 8000 characters (4000 for Unicode characters).

Storage of large-volume character data (up to 2 GB) is carried out using text types TEXT and NTEXT data.

TO integer data types include INT (INTEGER), SMALLINT, TINYINT, BIGINT. To store integer data, 4 bytes (range from -231 to 231-1), 2 bytes (range from -215 to 215-1), 1 byte (range from 0 to 255) or 8 bytes (range from -263) are used, respectively. to 263-1). Integer type objects and expressions can be used in any mathematical operation.

Numbers that contain a decimal point are called non-integer numbers. Non-integer data are divided into two types - decimal And approximate.

TO decimal Data types include DECIMAL [(precision[,scale])] or DEC and NUMERIC [(precision[,scale])]. The DECIMAL and NUMERIC data types allow you to independently define the precision format of a floating point number. The precision parameter indicates maximum amount digits of the input data of this type (before and after the decimal point in the total), and the scale parameter is the maximum number of digits located after the decimal point. IN normal mode the server allows you to enter a maximum of 28 digits used in the DECIMAL and NUMERIC types (from 2 to 17 bytes).

TO approximate Data types include FLOAT (precision up to 15 digits, 8 bytes) and REAL (precision up to 7 digits, 4 bytes). These types represent data in floating point format, i.e. a mantissa and exponent are used to represent numbers, ensuring the same precision in calculations no matter how small or large the value is.

To store information about date and time data types such as DATETIME and SMALLDATETIME are intended, which use 8 and 4 bytes to represent date and time, respectively.

MONEY and SMALLMONEY data types make it possible to store information of monetary type; they provide value precision to 4 decimal places and use 8 and 4 bytes respectively.

BIT data type allows you to store one bit that can take the values ​​0 or 1.

The SQL Server environment implements a number of special types data.

Data type TIMESTAMP used as an indicator of a row version change within a database.

Data type UNIQUE IDENTIFIER used to store globally unique identification numbers.

Data type SYSNAME intended for object identifiers.

Data type SQL_VARIANT allows you to store values ​​of any of the data types supported by SQL Server with the exception of TEXT, NTEXT, IMAGE and TIMESTAMP.

Data type TABLE, like temporary tables, provide storage for a set of rows intended for subsequent processing. The TABLE data type can only be used to define local variables and return custom functions values.

Data type CURSOR needed for working with objects such as cursors, and can only be used for variables and parameters of stored procedures. SQL Server cursors are a mechanism for exchanging data between a server and a client. The cursor allows client applications not work with full set data, but with only one or a few rows.


©2015-2019 site
All rights belong to their authors. This site does not claim authorship, but provides free use.
Page creation date: 2016-08-08

The list below shows that Microsoft SQL Server supports most SQL 2003 data types. SQL Server also supports additional types data used to uniquely identify rows of data in a table and across multiple servers, such as UNIQUEIDENTIFIER, which is consistent with Microsoft's "breadth-first" hardware philosophy (i.e., deploying a database across multiple servers on Intel platforms), instead of “growing in height” (that is, implementation on one huge powerful UNIX server or Windows Data Center Server).

An interesting aside regarding dates on SQL Server: SQL Server supports dates back to 1753. You can't store earlier dates in any data type SQL databases Server. Why? The reason is that the English-speaking world began using the Gregorian calendar in 1753 (the Julian calendar was used until September 1753), and converting Julian calendar dates to the Gregorian calendar could be quite difficult.

BIGINT (SQL 2003 data type: BIGINT)

Stores signed and unsigned integers in the range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Occupies 8 bytes. See INT type for IDENTITY property rules that also apply to BIGINT type.

BINARY[(n)](SQL 2003 data type: BLOB)

Stores a fixed-length binary value from 1 to 8000 bytes. A BINARY value takes up n + 4 bytes.

BIT (SQL 2003 data type: BOOLEAN)

Stores the values ​​1, 0, or NULL, which stands for "unknown". One byte can store up to 8 values ​​from columns of the BIT table type. One more byte can accommodate an additional 8 BIT values. Columns of type BIT cannot be indexed.

CHAR[(n)], CHARACTER[(n)] (SQL 2003 data type: CHARACTER(n))

Stores fixed-length character data from 1 to 8000 characters. Any unused space is filled with spaces by default. (Automatic padding can be disabled.) The type is n bytes.

CURSOR (SQL 2003 data type: missing)

A special data type used to describe a cursor in the form of a variable or stored procedure parameter OUTPUT. The type cannot be used in a CREATE TABLE statement. The CURSOR type can be NULL.

DATETIME (SQL 2003 data type: TIMESTAMP)

Stores a date and time value in the range from 01-01-1753 00:00:00 to 31-12-9999 23:59:59. Storage requires 8 bytes.

DECIMAL (p. s). DEC (p, s), NUMERIC (p, s) (SQL 2003 data type: DECIMAL (p, s). NUMERIC (p. s))

Stores decimals up to 38 digits long. The p and s values ​​determine the precision and scale, respectively. The default scale is 0. The space the value takes up is determined by the precision used. For precision 1-9, 5 bytes are used. For precision 10-19, 9 bytes are used. With a precision of 20-28, 13 bytes are used. With precision 29-39, 17 bytes are used.

See the INT type for IDENTITY property rules that also apply to the DECIMAL type.

DOUBLE PRECISION (SQL 2003 data type: none) Synonym for FLOAT(53).

FLOAT[(n)] (SQL 2003 data type: FLOAT, FLOAT(n))

Stores floating point values ​​in the range -1.79E + 308 to 1.79E + 308. The precision, determined by the parameter n, can vary from 1 to 53. To store 7 digits (and - from 1 to 24) requires 4 bytes. Values ​​greater than 7 digits occupy 8 bytes.

IMAGE (SQL 2003 data type: BLOB)

Stores a binary value of variable length up to 2,147,483,647 bytes. This data type is often used to store graphics, sound and files such as Microsoft documents Word and spreadsheets Microsoft Excel. Values ​​of type IMAGE cannot be freely manipulated. IMAGE and TO columns have many restrictions on how they can be used. See the description of the TEXT type for a list of commands and functions that also apply to the IMAGE type.

INT (SQL 2003 data type: INTEGER)

Stores signed or unsigned integers in the range -2,147,483,648 to 2,147,483,647. Occupies 4 bytes. All integer types data, as well as types that store decimal fractions, support the IDENTITY property, identity is an automatically incremented row identifier. Refer to the CREATE/ALTERTABLE Statement section.

MONEY (SQL 2003 data type: missing)

Stores currency values ​​in the range -922337203685477.5808 to 922337203685477.5807. The value takes 8 bytes.

NCHAR(n), NATIONAL CHAR(n), NATIONAL CHARACTER) (SQL 2003 data type: NATIONAL CHARACTER(n))

Stores fixed-length UNICODE data of up to 4000 characters. Storage requires n*2 bytes.

NTEXT, NATIONAL TEXT(SQL 2003 data type: NCLOB)

Stores text fragments in UNICODE format up to 1,073,741,823 characters long. See the description of the TEXT type for a list of commands and functions that also apply to the NTEXT type.

Synonym for DECIMAL type. See the description of the INT type for rules related to the IDENTITY property.

NVARCHAR(n), NATIONAL CHAR VARYING(n), NATIONAL CHARACTER VARYING(n) (SQL 2003 data type: NATIONAL CHARACTER VARYING(n))

Stores UNICODE data of variable length up to 4000 characters. The space taken up is calculated as twice the length of all characters inserted in the field (number of characters * 2). In SQL Server system parameter SET ANSI_PADDING] for NCHAR and NVARCHAR fields is always set (ON).

REAL, FLOAT(24)(mun data SQL 2003: REAL)

Stores floating point values ​​in the range -3.40E+38 to 3.40E+38. Occupies 4 bytes. The REAL type is functionally equivalent to the FLOAT(24) type.

ROWVERSION (SQL 2003 data type: missing)

A unique number stored in a database that is updated whenever a row is updated. More earlier versions called TIMESTAMP.

SMALLDATETIME (SQL 2003 data type: missing)

Stores date and time in the range from "01-01-1900 00:00" to "06-06-2079 23:59" accurate to the minute. (Minutes are rounded down if seconds are 29.998 or less, otherwise they are rounded up greater value.) The value takes 4 bytes.

SMALLINT (SQL 2003 data type: SMALLINT)

Stores signed or unsigned integers in the range -32,768 to 32,767. Occupies 2 bytes. See the description of the INT type for rules related to the IDENTITY property that also apply to this type.

SMALLMONEY (SQL 2003 data type: missing)

Stores currency values ​​in the range from 214748.3648 to -214748.3647. The values ​​take 4 bytes.

SQL VARIANT (SQL 2003 data type: none)

Stores values ​​related to other supported SQLs Server types data, with the exception of types TEXT, NTEXT, ROWVERSION and other values ​​of the SQL_VARIANT type. Can store up to 8016 bytes of data, supported NULL values and DEFAULT. The SQL_VARIANT type is used in columns, parameters, variables, and return values ​​of functions and stored procedures.

TABLE (SQL 2003 data type: none)

A special type that stores the resulting set of data from the last process. Used exclusively for procedural processing and cannot be used in CREATE TABLE statements. This data type reduces the need to create temporary tables in many applications. Can reduce the need for procedure recompilations, thereby speeding up the execution of stored procedures and user-defined functions.

TEXT (SQL 2003 data type: CLOB)

Stores very large chunks of text up to 2,147,483,647 characters long. TECHNIC IMAGE values ​​are often much more difficult to manipulate than, say, VARCHAR values. For example, you cannot create an index on a column of type TEXT or IMAGE. TEXT type values ​​can be manipulated using the DATALENGTH, PATINDEX, SUBSTRING functions. TEXTPTR and TECH-TVALID, as well as the READTEXT, SET TEXTSIZE, UPDATETEXT and WR1TETEXT commands.

TIMESTAMP (SQL 2003 data type: TIMESTAMP)

Stores automatically generated binary number, which ensures uniqueness in the current database and therefore differs from the ANSI standard TIMESTAMP data type. The TIMESTAMP type takes up 8 bytes. Currently, instead of TIMESTAMP, it is better to use ROWVERSION values ​​to uniquely identify rows.

Stores unsigned integers in the range 0 to 255 and occupies 1 byte. See the description of the /L/G type for rules related to the IDENTITY property that also apply to this type.

UNIQUEIDENTIFIER (SQL 2003 data type: missing)

Represents a value that is unique across all databases and all servers. Represented in the form xxxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxxxxxx, in which each "x" represents hexadecimal number in the range 0-9 or a - f. The only operations that can be performed on values ​​of this type are comparison and testing for NULL. Columns of this type can use constraints and properties, with the exception of the IDENTITY property.

VARBINARY[(n)] (SQL 2003 data type: BLOB)

Represents a variable-length binary value, up to 8000 bytes. The space occupied is the size of the inserted data plus 4 bytes.

VARCHARf[(n)], CHAR VARYING [(n)], CHARACTER VARYING f(n)J (SQL 2003 data type: CHARACTER VARYING [(n)]

Stores fixed-length character data ranging in size from 1 to 8000 characters. The space taken up is equal to the actual size of the entered value in bytes, not the n value.