Skip to content

Commit

Permalink
Merge pull request #88 from dbt-msft/#84_cci_index_2014
Browse files Browse the repository at this point in the history
Resolves #84
  • Loading branch information
mikaelene authored Jan 21, 2021
2 parents ae919d9 + 26641a0 commit 4b3f7bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dbt/include/sqlserver/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,12 @@
{%- set cci_name = relation.schema ~ '_' ~ relation.identifier ~ '_cci' -%}
{%- set relation_name = relation.schema ~ '_' ~ relation.identifier -%}
{%- set full_relation = relation.schema ~ '.' ~ relation.identifier -%}
DROP INDEX IF EXISTS {{relation_name}}.{{cci_name}}
if EXISTS (
SELECT * FROM
sys.indexes WHERE name = '{{cci_name}}'
AND object_id=object_id('{{relation_name}}')
)
DROP index {{full_relation}}.{{cci_name}}
CREATE CLUSTERED COLUMNSTORE INDEX {{cci_name}}
ON {{full_relation}}
{% endmacro %}
Expand Down

0 comments on commit 4b3f7bc

Please sign in to comment.