autonumber while working with SQL

  • Thread starter Thread starter Ran BD
  • Start date Start date
Ran
In SQL Server, the following script will create an auto
numbered field called 'TestAutoNo', starting at 1 and
incrementing by 1.

CREATE TABLE [dbo].[Table1] (
[TestAutoNo] [numeric](18, 0) IDENTITY (1, 1) NOT
NULL
) ON [PRIMARY]
GO

If you are using an Access ADP, just set 'identity' to
yes, identity seed to 1 and identity increment to 1, while
maintaining the table to acheive the same thing.

Jim
 
and how do i display the number ?

Jim said:
Ran
In SQL Server, the following script will create an auto
numbered field called 'TestAutoNo', starting at 1 and
incrementing by 1.

CREATE TABLE [dbo].[Table1] (
[TestAutoNo] [numeric](18, 0) IDENTITY (1, 1) NOT
NULL
) ON [PRIMARY]
GO

If you are using an Access ADP, just set 'identity' to
yes, identity seed to 1 and identity increment to 1, while
maintaining the table to acheive the same thing.

Jim
-----Original Message-----
how can I define auto number datatype ?

thanks

Ran



.
 
Not sure what you are asking here. Are you trying to use
a form?; a report?... The identity number is just another
field in the table so is always available for display.

From a database design perpective though, auto number
fields are pretty meaningless to a user. If a number
needs displaying to a user then an auto number is probably
not the right thing to be using.

Jim
-----Original Message-----
and how do i display the number ?

Jim said:
Ran
In SQL Server, the following script will create an auto
numbered field called 'TestAutoNo', starting at 1 and
incrementing by 1.

CREATE TABLE [dbo].[Table1] (
[TestAutoNo] [numeric](18, 0) IDENTITY (1, 1) NOT
NULL
) ON [PRIMARY]
GO

If you are using an Access ADP, just set 'identity' to
yes, identity seed to 1 and identity increment to 1, while
maintaining the table to acheive the same thing.

Jim
-----Original Message-----
how can I define auto number datatype ?

thanks

Ran



.


.
 
Back
Top