Monday, March 19, 2012

Index on a Temp Table?

Hi,
Had a quick look around BOL and can't seem to find whether one can create an
index on a temp table?
Can anyone shed any light on this, please?
Cheers, Simonit's the same syntax as creating an index on a regular table.|||yes on # (local) and ## (global) prefixed tables. They are just tables and
can have everything that normal table have.
@. (local variable) tables can only have constraints defined in the DDL.
----
Louis Davidson - drsql@.hotmail.com
SQL Server MVP
Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design -
http://www.apress.com/book/bookDisplay.html?bID=266
Blog - http://spaces.msn.com/members/drsql/
Note: Please reply to the newsgroups only unless you are interested in
consulting services. All other replies may be ignored :)
"SBeetham" <sbeetham@.xtra.co.nz> wrote in message
news:urISWzsHFHA.3624@.tk2msftngp13.phx.gbl...
> Hi,
> Had a quick look around BOL and can't seem to find whether one can create
> an
> index on a temp table?
> Can anyone shed any light on this, please?
> Cheers, Simon
>
>|||SBeetham wrote:
> Hi,
> Had a quick look around BOL and can't seem to find whether one can
> create an index on a temp table?
> Can anyone shed any light on this, please?
> Cheers, Simon
You can create one.
Create Table #test (col1 int)
Create unique Clustered Index test_idx on #test(col1)
David Gugick
Imceda Software
www.imceda.com|||Even though it might not find its place on BOL, it is quite possible for
temp and global temp tables.
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
"SBeetham" <sbeetham@.xtra.co.nz> wrote in message
news:urISWzsHFHA.3624@.tk2msftngp13.phx.gbl...
> Hi,
> Had a quick look around BOL and can't seem to find whether one can create
an
> index on a temp table?
> Can anyone shed any light on this, please?
> Cheers, Simon
>
>|||From the Books Online article "CREATE INDEX":
"Indexes can be created on a temporary table."
Steve Kass
Drew University
SBeetham wrote:

>Hi,
>Had a quick look around BOL and can't seem to find whether one can create a
n
>index on a temp table?
>Can anyone shed any light on this, please?
>Cheers, Simon
>
>
>

No comments:

Post a Comment