xxxxxxxxxx
# Numeric Types
BIT TINYINT SMALLINT INT BIGINT DECIMAL NUMERIC FLOAT REAL
# Date & Time Types
DATE TIME DATETIME TIMESTAMP YEAR
# Char & String Types (N) Denotes Unicode Versions
CHAR VARCHAR TEXT NCHAR NVARCHAR NTEXT
# Binary Data Types
BINARY VARBINARY IMAGE
# Misc
CLOB BLOB XML JSON
xxxxxxxxxx
SELECT DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_SCHEMA = 'yourSchemaName' AND
TABLE_NAME = 'yourTableName' AND
COLUMN_NAME = 'yourColumnName'
xxxxxxxxxx
/*
INT: used to store integers (whole numbers) in the range of
-2^31 (-2,147,483,648) to 2^31 - 1 (2,147,483,647). It is commonly used to
store primary keys, identity columns, and other types of integer-based data.
BIGINT: used to store integers in the range of -2^63 (-9,223,372,036,854,775,808)
to 2^63 - 1 (9,223,372,036,854,775,807) . It is useful for storing large numbers
that cannot fit in the INT range.
SMALLINT: used to store integers in the range of -32,768 to 32,767.
TINYINT: used to store integers in the range of 0 to 255. It is commonly used
to store small numerical data, such as a "status" or "flag" column that can only
have a few different possible values.
FLOAT: used to store floating-point numbers, which are numbers that have a
decimal point. It can store very large or very small numbers, with a large
number of digits to the right of the decimal point. It is more efficient in
terms of storage space and speed of calculations, but less precise than DECIMAL
or NUMERIC.
DECIMAL and NUMERIC: used to store fixed-point numbers, which are numbers that
have a fixed number of digits to the right of the decimal point. They are more
precise than float, but the storage size and speed of calculations are relatively
larger. They are recommended to be used for financial calculations where
precision is key.
DATE, DATETIME, DATETIME2 : used to store date and time values. DATE stores only
the date part, DATETIME stores both the date and time parts, and DATETIME2
stores both the date and time parts, with a higher precision.
CHAR, VARCHAR, NVARCHAR: used to store character-based data. CHAR stores
fixed-length strings and VARCHAR stores variable-length strings. NVARCHAR is
used to store Unicode characters and is useful when you want to store multiple
languages.
BINARY, VARBINARY: used to store binary data, such as images or files. BINARY
stores fixed-length binary data and VARBINARY stores variable-length binary data.
BIT: used to store Boolean values (true/false or 1/0).
*/
xxxxxxxxxx
• number(num) - whole numbers up to num digits
• number(num,num2) - num whole numbers up to num2 decimals
• char(num) - fixed length character/string
• varchar2(num) - used for varying length data
• date - full date
• currency - used for prices
xxxxxxxxxx
DECLARE @query nvarchar(max) = 'select 12.1 / 10.1 AS [Column1]';
EXEC sp_describe_first_result_set @query, null, 0;