Auto-increment in SQL Server 2008 R2

352565 pts.
Tags:
SQL Server 2008 R2
SQL Server tables
I've just created a new table in SQL Server 2008 R2 and I'm trying to get the index on auto-increment. Is there a way to do this? 

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    I'm not sure to understand the question.
    Can you provide more details on what you are trying to do?
    70,220 pointsBadges:
    report
  • ITKE
    Thanks for the response Carlos. In the table, there's no identity data type, so I selected "int". I'm trying to define an INT column to be an identity. Does that make more sense?
    352,565 pointsBadges:
    report
  • carlosdl
    Oh, yes.

    That should be pretty easy. You just need to add the IDENTITY keyword with the appropriate parameters to your column definition.

    Something like this:

    CREATE TABLE yourTable (id INT IDENTITY(1,1));


    The parameters for the identity definition correspond to seed and increment.

    70,220 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following