IF EXISTS 
( 
    SELECT * 
    FROM sys.views 
    WHERE object_id = OBJECT_ID(N'[dbo].[V_TELE_ORC_TRANSITO_COMP]') 
) 
    DROP VIEW [dbo].[V_TELE_ORC_TRANSITO_COMP]; 
GO 


CREATE VIEW [dbo].[V_TELE_ORC_TRANSITO_COMP]
AS
SELECT     CD_FILIAL, CD_ORC, CD_SAIDA_ORC, DTHR_ETAPA, ENT_DTHR, DATEDIFF(minute, GETDATE(), ENT_DTHR) AS PRAZO, CD_ENTREGADOR, 
                      DS_ENTREGADOR, TIPO, CD_SAIDA
FROM         dbo.V_TELE_ORC_TRANSITO


GO


