index on temp table

  • Hi,

    I tried to put create index script on temp table after writing create temp table script. But that time it failed. But when tried to put index creation script after inset into temp table script that time it was successful. Could someone please explain it?

    I am writing down the order

    (Failed)

    1> create temp table

    2> Create index

    3>insert into temp table

    (Successful)

    1> create temp table

    2>insert into temp table

    3> Create index

    Thanks in advance

  • Both options should work fine. Without seeing the code you ran and the error that you got, I can't tell you why it didn't work.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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