SQLexpress and autoincrement

I've been searching for an answer a long time now... but nowhere I found a clear solution...

Is it possible to implement autoincrement with SQLexpress edition



Answer this question

SQLexpress and autoincrement

  • Keith Farmer

    are you talking about IDENTITY property for integer-type column Yes it's supported.
  • RS99

    Hi

    I already have a customers table in sqlexpress.

    whenever I do dataset.customerstable.row.add it gives an error about one of the fields can't be null.

    I made customerid field, uniqeidentifier ; this didn't make the field autoincrement.

    how do I make this field autoincrement


  • ilico

    Now, in the VS2005 IDE, is there anyway to use the identity on an int Because when I build a Table, int is a choice, but I cnat seem to find the identity(x,x) or, increment keywords anywhere.

    Any help is appreciated.

  • Nils Loeber

    you can apply IDENTITY to only integer type datatypes. In books online, please search for "identity" to get a better understanding of how this is used. For uniqueidentifer columns, search for "newsequentialid" which allows you an increment a uniqueidentifier column.


  • Wolfsvein

    As Greg points out it is supported, but refered to as Identity not autoincrement.

    Here's how you'd create a table with an identity column

    create table t1 (col1 int identity(1,1), col2 varchar(50))

    -Jerome



  • WhatSayYou

    thanks, that is what i was looking for!

    thank you both for the help...


  • SQLexpress and autoincrement