Hi Everyone,
If you great an identity column using the statement below, what is the
maximum value the identity column will increment to? Is it the it the
maximum value of the column data type? In this case 32,768? I tried a loop
to add 100,000 rows and it did so without any error. Thanks in advance.
Larry
create table test_table
(
Doc_Index INT IDENTITY(1,1) NOT NULL
)The maximum value is determined by the datatype. In this case you've used
INT for which the maximum is 2,147,483,647. So you have some way to go yet
...
--
David Portas
SQL Server MVP
--|||Each integer datatype will allow so many as David pointed out.
So a tinying (1 byte = 8 bits) = 2^8 or 256
smallint (2 bytes = 16 bits) = 2^16 or 32767
int (4 bytes = 32 bits) = 2^32 or 2.14 billion
bigint (8 byte = 64 bits) = 2^64 or a whole bunch
You can also use a scaled integer like decimal, just set the scale to 0.
Decimal(15,0) = a really really big number.
Rick Sawtell
MCT, MCSD, MCDBA
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:BKWdnc2hu_wFJ_jcRVn-ig@.giganews.com...
> The maximum value is determined by the datatype. In this case you've used
> INT for which the maximum is 2,147,483,647. So you have some way to go yet
> ...
> --
> David Portas
> SQL Server MVP
> --
>|||You must be thinking of an INT in VBScript. In SQL Server, the upper bound
of an INT is over 2 billion. If that isn't enough, you could go to BIGINT
(assuming SQL Server 2000). http://www.aspfaq.com/2503
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Larry" <Larry@.discussions.microsoft.com> wrote in message
news:4DF935A2-34AB-4509-B131-BC7FD1FD0B91@.microsoft.com...
> Hi Everyone,
> If you great an identity column using the statement below, what is the
> maximum value the identity column will increment to? Is it the it the
> maximum value of the column data type? In this case 32,768? I tried a
loop
> to add 100,000 rows and it did so without any error. Thanks in advance.
> Larry
> create table test_table
> (
> Doc_Index INT IDENTITY(1,1) NOT NULL
> )|||Larry wrote:
> Hi Everyone,
> If you great an identity column using the statement below, what is the
> maximum value the identity column will increment to? Is it the it the
> maximum value of the column data type? In this case 32,768? I tried
> a loop to add 100,000 rows and it did so without any error. Thanks
> in advance. Larry
> create table test_table
> (
> Doc_Index INT IDENTITY(1,1) NOT NULL
> )
INT in SQL Server is the same as Long in VB (4 bytes). It's not the same
as a VB Integer (2 bytes).
--
David Gugick
Imceda Software
www.imceda.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment