get a sorted query into a temp table

  • hi

    does anyone know how i can get a query into a temp table while having it sorted in the manner i wish?

    thanks!!

  • Just add Order By to your query, like:

    CREATE TABLE #tbltest

    (ROW_ID INTEGER IDENTITY(1,1)

    ,Client_Code int

    ,Client_name varchar(100)

    )

    insert #tbltest

    select Client_code,Client_name

    from tblClient where Date_Created >'05/01/2002'

    order by Client_Code

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

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