简体   繁体   中英

Min and Max length of a column in SQL

I have a table with two columns

CREATE TABLE [dbo].[tbl_Orders]
(
    [OrderID] [bigint] NOT NULL IDENTITY(500000, 1)
    ,[OrderDate] [date] NULL
)

I would like to know the min and max length of column OrderID How many characters can it store?

Since ident is starting from 500000, the min(length) would be 6, and how can I find the max length?

Size of bigint is 8 bytes. It can store -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807). So maximum length of OrderID will be 19 (9,223,372,036,854,775,807).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM