digital

Int, BigInt, SmallInt and tinyInt

An exact numeric data type that uses integer data.

Decimal [(p[,s])] and numeric[(p[,s])]

A numeric data type with fixed precision and decimal places. Decimal and numeric are synonyms and are used interchangeably.

Fixed precision and decimal places. When using maximum accuracy, valid values range from -10 ^38 +1 to 10^ 38-1. ISO synonyms for decimal are dec and DEC (p, s). Numeric is functionally equivalent to decimal.

P (accuracy)

The maximum number of decimal digits that can be stored, including the digits to the left and right of the decimal point. The precision must be a value between 1 and a maximum of 38. The default precision is 18.

S (decimal number)

The number of decimal digits that can be stored to the right of the decimal point. Subtracting this number from p determines the maximum number of digits to the left of the decimal point. The maximum number of decimal digits that can be stored to the right of the decimal point. The decimal number must be between 0 and p. You can specify the decimal number only after you specify the precision. The default decimal number is 0; Therefore, 0 <= s <= P. The maximum storage size varies based on accuracy.

Money and smallmoney

The Money and SmallMoney data types are accurate to 1/10,000th of the monetary unit they represent.

bit

An INTEGER data type that can be 1, 0, or NULL.

The SQL Server database engine optimizes the storage of bit columns. If the columns in the table are 8 bits or less, the columns are stored as 1 byte. If the columns are 9 to 16 bits, the columns are stored as 2 bytes, and so on.

String values TRUE and FALSE convert to bit values: TRUE converts to 1 and FALSE converts to 0.

Converting to bit increases any non-zero value to 1.

Float and real

The approximate numerical data type used to represent floating-point numerical data. Floating point data are approximations; Therefore, not all values in the range of data types can be accurately represented. The ISO synonym for real is float(24).

Float [(n)] where n is the number of bits (in scientific notation) used to store the mantissa of a float value, so precision and storage size can be determined *. If n is specified, it must be some value between 1 and 53. The default value of n is 53.

Date/time

cursor

Some operations can refer to variables and parameters that have the cursor data type. These operations include:

DECLARE @local_variable and SET @local_variable statements. OPEN, FETCH, CLOSE, and DEALLOCATE cursor statements. Stored procedure output parameters. CURSOR_STATUS function. Sp_cursor_list, SP_describe_CURSOR, SP_describe_cursor_tables, and SP_describe_cursor_columns stored procedures.

The cursor_NAME output column of sp_cursor_list and SP_describe_CURSOR returns the name of the cursor variable. All variables created using the CURSOR data type can be Null. The CURSOR data type cannot be used for columns in the CREATE TABLE statement.

rowversion

Exposes the data type of a unique binary number automatically generated in the database. Rowversion is often used as a mechanism to version stamp table rows. The storage size is 8 bytes. The RowVersion data type is just an increasing number and does not retain a date or time. To record a date or time, use the datetime2 data type.

Each database has a counter whose value is increased when an insert or update is performed on a table in the database that contains a RowVersion column. This counter is the database row version. This keeps track of relative times in the database, rather than the actual times associated with the hours. A table can have only one RowVersion column. Each time a row containing a RowVersion column is modified or inserted, the incremental database RowVersion value is inserted into the RowVersion column. This attribute makes the RowVersion column unsuitable for use as a key, especially as a primary key. Any update to the row changes the row version value, thereby changing the key value. If the column is a primary key, the old key value is invalid, and the foreign key that references that old value is no longer valid. If the table is referenced in a dynamic cursor, all updates change the position of the row in the cursor. If the column is an index key, all updates to the data row will also result in index updates. Using any update statement increments the RowVersion value, even if no row value has changed. (For example, if a column has a value of 5 and the update statement sets that value to 5, the operation is considered an update even if nothing has changed and the RowVersion is incremented.)

The data type of TIMESTAMP is a synonym of the RowVersion data type and has the behavior of a synonym of the data type. In DDL statements, use rowVersion instead of TIMESTAMP whenever possible.

Binary and varbinary

Space type – Geography

The geospatial data type Geography is implemented as a.NET Common Language Runtime (CLR) data type in SQL Server. This type represents data in a circular earth coordinate system. The SQL Server Geography data type stores ellipsoid (circular earth) data such as GPS latitude and longitude coordinates.

SQL Server supports a set of methods for the Geography spatial data type. These methods include the Open Geospatial Information Consortium (OGC) standard and the Geography method defined by a set of Microsoft extensions to that standard.

The Geography method is fault-tolerant up to 1.0E-7 * extents. Extents represents the approximate maximum distance between points in the Geography object.

The Geography type is predefined and available in each database. You can create table columns of type Geography and manipulate geography data just as you would with any data type provided by any other system. Can be used in persistent and nonpersistent computed columns.

sql_variant

Sql_variant can be used for columns, parameters, variables, and return values of user-defined functions. With SQL_VARIANT, these database objects can support values of other data types.

Columns of type SQL_VARIANT may contain rows of different data types. For example, a column defined as SQL_VARIANT can store values of the types int, binary, and CHAR.

The maximum length for sql_VARIANT can be 8016 bytes. This includes base type information and base type values. The actual maximum length of a base type value is 8,000 bytes.

For the SQL_VARIANT data type, you must first convert it to its base data type value before you can participate in operations such as addition and subtraction.

Default values can be assigned to SQL_VARIANT. The data type can also have NULL as its base value, but NULL values have no associated base type. In addition, SQL_VARIANT cannot use other SQL_variants as its base type.

Unique keys, primary keys, or foreign keys may contain columns of type SQL_VARIANT, but the total length of the data values that make up the keys for the specified row should not be greater than the maximum length of the index. The maximum length is 900 bytes.

A table can contain any number of SQL_VARIANT columns.

Sql_variant cannot be used in CONTAINSTABLE and FREETEXTTABLE.

Sql_variant is not fully supported by ODBC. Therefore, queries for the SQL_VARIANT column are returned as binary data when using the Microsoft OLE DB Provider for ODBC (MSDASQL). For example, the SQL_VARIANT column containing the string data ‘PS2091’ will be returned as 0x505332303931.

table

A special data type that can be used to store a result set for subsequent processing. Table is primarily used to temporarily store a set of rows returned as the result set of a table-valued function. Functions and variables can be declared as table types. The table variable can be used in functions, stored procedures, and batch processing.

uniqueidentifier

The storage space is 16 bytes GUID.

A column or local variable of the UniqueIdentifier data type can be initialized to a value in the following way:

By using the NEWID or NEWSEQUENTIALID functions. By converting from a string constant of the form xxxxXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, where each x is a hexadecimal number in the range 0-9 or A-f. For example, 6F9619FF-8b86-D011-b42D-00c04FC964FF is a valid uniqueIdentifier value. The comparison operator can be used with the UniqueIdentifier value. However, sorting is not done by comparing the bit patterns of two values. The only operations that can be performed against the UniqueIdentifier value are comparison operations (=, <>, <, >, <=, >=) and checking for NULL (IS NULL and IS NOT NULL). No other arithmetic operators can be used. All column constraints and attributes except IDENTITY are available for the UniqueIdentifier data type.

Merge replication and transactional replication with update subscriptions use the UniqueIdentifier column to ensure that rows are uniquely identified across multiple copies of the table.

XML

The data type that stores XML data. XML instances can be stored in columns or in variables of type XML.

The stored XML data type indicates that the instance size cannot exceed 2 GB.

The CONTENT and DOCUMENT aspects apply only to typed XML.

CONTENT limits XML instances to well-formed XML fragments. The top layer of XML data can contain more than one zero or more elements. You can also use text nodes at the top level. This is the default behavior.

DOCUMENT limits XML instances to well-formed XML fragments. XML data must have only one root element. Text nodes are not allowed at the top level.

Xml_schema_collection XML schema collection name. To create typed XML columns or variables, optionally specify the XML schema collection name.