블로그 이미지
fiadot_old

칼퇴근을 위한 게임 서버 개발 방법론에 대한 심도있는 고찰 및 성찰을 위한 블로그!

Rss feed Tistory
Technical Article/펌 2004. 8. 17. 20:59

DB에 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) )
,
TOTAL TODAY