/****** Object:  View [dbo].[V_BI_USUARIOS]    Script Date: 04/11/2013 10:05:53 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[V_BI_USUARIOS]'))
DROP VIEW [dbo].[V_BI_USUARIOS]
GO
--SELECT * FROM V_BI_USUARIOS
CREATE VIEW V_BI_USUARIOS
AS
SELECT
GLB_USU.CD_USU AS CdUsuario,
GLB_USU.NM_USU AS NomeUsuario,
DS_CARGO AS Cargo
FROM
GLB_USU INNER JOIN FP_FUNC ON
GLB_USU.CD_USU = FP_FUNC.CD_FUNC_USU
INNER JOIN FP_CARGO ON
FP_FUNC.CD_EMP = FP_CARGO.CD_EMP AND
FP_FUNC.CD_CARGO = FP_CARGO.CD_CARGO
UNION ALL
SELECT
0 AS CdUsuario,
'NAO DEFINIDO' AS NomeUsuario,
'NAO DEFINIDO' AS Cargo