Auto Increment is SQL Query

  • i want to add an auto increment column in my query ,u can say it as a serial no.

  • 'auto increment column'

    U can select an IDENTITY type column and all the other fields from the required table into a temporary table and the select from that temporary table like:

    USE pubs

    GO

    SELECT IDENTITY(int,1,1) AS ID, *

    INTO #newtab

    FROM authors

    SELECT * FROM #newtab

    GO

    (Thanks to Neil Pike)

    Regards.

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

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