Query Building.

  • I have a table called 'Recent_Upload' that contains 52 fields. I want to copy that table to a new table and add a unique key to it. Can this be done by executing one query? What would a query like that look like?

    Thank you! 🙂

  • How about this?

    SELECT IDENTITY(INT, 1, 1 ) AS ID , Col1 , Col2 ......Col52

    INTO New_Table

    FROM Old_Table

    CREATE UNIQUE NONCLUSTERED INDEX IDX_New_Table_ID

    ON New_Table(ID)

  • At first glance I can understand generally everything except 'IDENTITY(INT 1, 1)'. What is that doing exactly?

  • Thats a function much like your normal IDENTITY property of a column.

    You can refer and learn more about that function HERE

    I'am sorry , i am actually in the middle of completing a work, so cant explain in detail abt the function. When done with the task, i ll come back to explain 🙂

  • I read the documentation and it's very clear. Thank you very kindly for this wonderful post.

Viewing 5 posts - 1 through 4 (of 4 total)

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