identity ??

  • Hi ,

    Please help to know what is the limit of identity ....I ran this command and it worked but i dont know maximum limit

    create table testj(

    id int identity (1,500000000))

  • U can check the url

    http://msdn.microsoft.com/en-us/library/ms187745.aspx

  • disha1 (5/20/2011)


    Hi ,

    Please help to know what is the limit of identity ....I ran this command and it worked but i dont know maximum limit

    create table testj(

    id int identity (1,500000000))

    I think u are misunderstanding the syntax... 500000 is not the limit rather the increment each row should take..

  • yes , right but here i got another problem..i m not able to insert data in this table

    create table testj(

    id int identity (1,500000000))

    i tried these statments but got the error :

    Msg 8101, Level 16, State 1, Line 2

    An explicit value for the identity column in table 'testj' can only be specified when a column list is used and IDENTITY_INSERT is ON.

    insert into testj values()

    or

    insert into testj values(1)

    or

    insert into testj values(2)

    or

    insert into testj values(499999999)

  • the max value of the column, whether it's inserted by the identity() or not, is the max value of the data type...int, bigint, whatever type you decide.

    an int is 2 billion and change, you can look it up; it's one less than this:select POWER(2,31) (2147483647)

    because you have no other columns in your insert statement, other than the Id column, you have to use the DEFAULT VALUES command:

    create table testj(

    id int identity (1,500000000))

    insert into testj DEFAULT VALUES

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • thanks a lot Lowell..it was great help...when will i have this much of brain 🙂

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply