Results 1 to 3 of 3

Thread: MSSQL auto numbering / identity

  1. #1
    Join Date
    May 2005
    Posts
    2

    MSSQL auto numbering / identity

    Hello!

    I'm having trouble finding a solution to this auto numbering problem.
    I know there can't be 2 IDENTITY datatypes in the same table like the sample tables below. But how do I solve this problem? Is there another way to do this?
    Hope you understand my problem=)

    The sample tables tries to display categories. A main-categori that whitch have under-categories.

    CREATE TABLE dbo.MainCat
    (
    h_catID INT IDENTITY(1,1) NOT NULL,
    h_cat_name CHAR(30),
    CONSTRAINT PK_h_catID PRIMARY KEY CLUSTERED ( h_catID )
    )

    CREATE TABLE dbo.UnderCat
    (
    u_catID INT IDENTITY(1,1) NOT NULL,
    u_cat_name CHAR(30),
    h_catID INT IDENTITY(1,1) NOT NULL,
    CONSTRAINT PK_u_catID PRIMARY KEY CLUSTERED ( u_catID )
    )

    nitefly

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254

  3. #3
    Join Date
    May 2005
    Posts
    2
    Thank you so much..=)

    Nitefly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •