Identities and Sequences IV

  • Comments posted to this topic are about the item Identities and Sequences IV

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • None of the references in the Explanation contain the keyword decimal.

    The description of the Identity function states in the introduction that "IDENTITY

    is used only in a SELECT statement with an INTO table clause to insert an identity column into a new table.

    Although similar, the IDENTITY function is not the IDENTITY property that is used with CREATE TABLE and ALTER TABLE.

    However, the description of the data_type argument states that "Valid data types for an identity column

    are any data types of the integer data type category, except for the bit data type,

    or decimal data type."

    And this statement confused me, a simple test gave the answer, but it was too late... 🙂

    CREATE TABLE img (

    id_num decimal IDENTITY, -- or IDENTITY (1,1), but not IDENTITY (1.0, 1) --

    company_name SYSNAME

    );

    INSERT img (company_name)

    VALUES ('New Moon Books'), ('Lucerne Publishing');

    SELECT * FROM img;

    Results

    --------------------------

    id_num company_name

    1 New Moon Books

    2 Lucerne Publishing

    ==========================

    Steve thanks for this question.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply