글
Technical Article/펌 2004. 8. 17. 20:59DB에 BigInt 사용하기
Specifying bigint Constants
Whole number constants that are outside the range supported by the int data type continue to be interpreted as numeric, with a scale of 0 and a precision sufficient to hold the value specified. For example, the constant 3000000000 is interpreted as numeric. These numeric constants are implicitly convertible to bigint and can be assigned to bigint columns and variables:
CREATE TABLE BigintTable (ColA bigint)
INSERT INTO BigintTable VALUES (3000000000)
SELECT *
FROM BigintTable
WHERE ColA = 3000000000
You can also cast constants to bigint:
CAST(3000000000 AS bigint)
To get a bigint value into an sql_variant column, use this method:
CREATE TABLE VariantTable (ColA sql_variant)
-- Inserts a value with a numeric base data type.
INSERT INTO VariantTable VALUES (3000000000)
-- Inserts a value with a bigint base data type.
INSERT INTO VariantTable VALUES ( CAST(3000000000 AS bigint) )
Whole number constants that are outside the range supported by the int data type continue to be interpreted as numeric, with a scale of 0 and a precision sufficient to hold the value specified. For example, the constant 3000000000 is interpreted as numeric. These numeric constants are implicitly convertible to bigint and can be assigned to bigint columns and variables:
CREATE TABLE BigintTable (ColA bigint)
INSERT INTO BigintTable VALUES (3000000000)
SELECT *
FROM BigintTable
WHERE ColA = 3000000000
You can also cast constants to bigint:
CAST(3000000000 AS bigint)
To get a bigint value into an sql_variant column, use this method:
CREATE TABLE VariantTable (ColA sql_variant)
-- Inserts a value with a numeric base data type.
INSERT INTO VariantTable VALUES (3000000000)
-- Inserts a value with a bigint base data type.
INSERT INTO VariantTable VALUES ( CAST(3000000000 AS bigint) )

RECENT COMMENT