As most people working with Sql Server know, you can declare a temporary table as follows:
create table
... this will create a primary key and a default constraint for this temporary table; the names of these objects will be unique, dynamically generated by Sql Server.
Is it possible to create a dynamically named index for a table after creating it? I have a case where a stored procedure using temporary tables can run multiple instances at the same time, and I would like to increase performance without the risk of conflict between identically named objects in the tempdb database. The CREATE INDEX
command requires an explicit index name.
I am looking for a solution that does not include dynamic SQL, just dynamic names.
Jeremy holovacs
source share