Index on view (2a parte)

01/06/2004 - 16:31 por Isaías | Informe spam
Pues ahi tienen que le di drop a mi tabla (respaldando la
informacion de la misma), la volvi a crear, no sin antes
colocar en ON el ANSI_NULLS.

Al momento de crear la vista con la opcion: WITH
SCHEMABINDING

Todo bien, pero al momento de crear el indice:

CREATE UNIQUE CLUSTERED INDEX key_view_1403 ON
view_1403_MI_other (HORA, MINUTO)

Me envia este error:

Server: Msg 1936, Level 16, State 1, Line 1
Cannot index the view 'view_1403_MI_other' It contains one
or more disallowed constructs.

Este es el script de mi vista:

CREATE view view_1403_MI_other
WITH SCHEMABINDING
AS
SELECT DATEPART(hh,fd_FileInputDateTime) AS HORA,
DATEPART(mi,fd_FileInputDateTime) AS MINUTO,
COUNT(fb_InputFileStatus) as TOTAL
FROM dbo.file_1403
WHERE fd_FileInputDateTime BETWEEN CONVERT(CHAR
(10),GETDATE(),120)+' 00:00:00' AND DATEADD(MI,-3,GETDATE
())
AND fb_InputFileStatus = 1
GROUP BY datepart(hh,fd_FileInputDateTime), datepart
(mi,fd_FileInputDateTime)

Estoy metido en un lio.

Cualquier comentario, gracias.
 

Leer las respuestas

#1 Jose Mariano Alvarez \(MUG\)
01/06/2004 - 18:20 | Informe spam
No puedes usar Count(*), debes usar Count_Big(*)

Tampoco puedes usar GetDate() porque es no determinista.


Jose Mariano Alvarez
Comunidad de base de datos
Grupo de Usuarios Microsoft
www.mug.org.ar


"Isaías" wrote in message
news:1662201c447e5$24258ca0$

Pues ahi tienen que le di drop a mi tabla (respaldando la
informacion de la misma), la volvi a crear, no sin antes
colocar en ON el ANSI_NULLS.

Al momento de crear la vista con la opcion: WITH
SCHEMABINDING

Todo bien, pero al momento de crear el indice:

CREATE UNIQUE CLUSTERED INDEX key_view_1403 ON
view_1403_MI_other (HORA, MINUTO)

Me envia este error:

Server: Msg 1936, Level 16, State 1, Line 1
Cannot index the view 'view_1403_MI_other' It contains one
or more disallowed constructs.

Este es el script de mi vista:

CREATE view view_1403_MI_other
WITH SCHEMABINDING
AS
SELECT DATEPART(hh,fd_FileInputDateTime) AS HORA,
DATEPART(mi,fd_FileInputDateTime) AS MINUTO,
COUNT(fb_InputFileStatus) as TOTAL
FROM dbo.file_1403
WHERE fd_FileInputDateTime BETWEEN CONVERT(CHAR
(10),GETDATE(),120)+' 00:00:00' AND DATEADD(MI,-3,GETDATE
())
AND fb_InputFileStatus = 1
GROUP BY datepart(hh,fd_FileInputDateTime), datepart
(mi,fd_FileInputDateTime)

Estoy metido en un lio.

Cualquier comentario, gracias.








Revisado por AVG

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.693 / Virus Database: 454 - Release Date: 31/05/2004

Preguntas similares