Sintoma: Ao tentar indexar uma coluna calculada no Sql Server 2005 Enterprise SP2, o seguinte erro se apresentou: “Cannot create index or statistics 'coluna' on table 'tabela' because the computed column 'coluna' is imprecise and not persisted. Consider removing column from index or statistics key or marking computed column persisted.”.
Causa: Uma das restrições para indexação de colunas calculadas, é que estas devem ser determinísticas ou devem ser persistidas no banco.
Solução: A coluna foi excluída e re-criada com o comando PERSISTED.
ALTER TABLE TABELA
ADD COLUNA AS (COLUNA1+COLUNA2) PERSISTED
Abraços e até a próxima!
Nenhum comentário:
Postar um comentário
Leave your comment here!