|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi
I have a PK column which I need to be auto increment. In order to auto increment is it better to a0 set the column's identity values or b) set the column's 'Default Value or Binding' property to expression (CONVERT([int],CONVERT([varbinary](4000),newid(),0),0))? Many Thanks |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
If you want it to be an integer, use an Identity column.
Sincerely, Chuck Heinzelman "John" <info@nospam.infovis.co.uk> wrote in message news:Ob4Z0tt5IHA.4596@TK2MSFTNGP03.phx.gbl... > Hi > > I have a PK column which I need to be auto increment. In order to auto > increment is it better to a0 set the column's identity values or b) set > the column's 'Default Value or Binding' property to expression > (CONVERT([int],CONVERT([varbinary](4000),newid(),0),0))? > > Many Thanks > |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
> I have a PK column which I need to be auto increment. In order to auto
> increment is it better to a0 set the column's identity values or b) set > the column's 'Default Value or Binding' property to expression > (CONVERT([int],CONVERT([varbinary](4000),newid(),0),0))? If it's an int column, then set the identity flag. Otherwise it looks like you're going for a pseudo-random, but not unique, value. (The first 4 bytes of a guid are not incremented sequentially) If it's a uniqueidentifier, then you should actually use newid() as the default value. |
|
![]() |
| Outils de la discussion | |
|
|