Skip to content

Instantly share code, notes, and snippets.

@donpandix
Last active May 12, 2021 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donpandix/29088a8cd7cb34aba6056180b735c033 to your computer and use it in GitHub Desktop.
Save donpandix/29088a8cd7cb34aba6056180b735c033 to your computer and use it in GitHub Desktop.
Creación de tablas temporales con indice
CREATE TABLE #tabla_temporal (
id_tabla BIGINT
,cd_columna_01 BIGINT
,gl_columna_02
)
CREATE NONCLUSTERED INDEX idx_tabla_temporal ON #tabla_temporal ([id_tabla])
-- Otras formas de definir indices
-- Indice no ordenado
CREATE INDEX idx_tabla_temporal ON #tabla_temporal (id_tabla);
-- Indice a partir de 2 columnas
CREATE UNIQUE INDEX idx_tabla_temporal ON #tabla_temporal (id_tabla asc, cl_columna_01 asc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment