Martini
|
PAROBÉ RS - BRASIL
|
|
ENUNCIADA !
|
|
|
Postada em 21/09/2004 13:19 hs
SELECT CentroCusto, Empresa, Plaqueta, Parcela, ContaRed, ContaPatrimonial, Descricao, CodDescPad, OutroEstado, CodLocal, CodTipo, Serie, Marca, Inventario, AltCentroCusto, AltDescricao, AltOutro, AltLocal, AltTipo, AltSerie, AltModelo, Conta, Item, CBase, SeqRecno, CentroCusto + Empresa + Plaqueta + Parcela + ContaRed + ContaPatrimonial + Descricao + CodDescPad + OutroEstado + CodLocal + CodTipo + Serie + Marca + Inventario + AltCentroCusto + AltDescricao + AltOutro + AltLocal + AltTipo + AltSerie + AltModelo AS Linha FROM (SELECT Cast(CTT_RES AS Char(6)) AS CentroCusto, '0001' AS Empresa, RIGHT(Replicate(' ', 8) + RTrim(Ltrim(N1_CHAPA)), 8) AS Plaqueta, '0' AS Parcela, Replicate(' ', 7) AS ContaRed, Replicate(' ', 11) AS ContaPatrimonial, Cast(Substring(Rtrim(Ltrim(N1_DESCRIC)), 1, 40) AS Char(40)) AS Descricao, Replicate(' ', 6) AS CodDescPad, Replicate(' ', 6) AS OutroEstado, Cast(Replace(N1_LOCAL, '.', '') AS Char(6)) AS CodLocal, Replicate(' ', 6) AS CodTipo, Cast(Substring(Rtrim(Ltrim(N1_SERIE)), 1, 25) AS Char(25)) AS Serie, Cast(Substring(Rtrim(Ltrim(N1_MARCA)), 1, 25) AS Char(25)) AS Marca, '0' AS Inventario, '0' AS AltCentroCusto, '0' AS AltDescricao, '0' AS AltOutro, '0' AS AltLocal, '0' AS AltTipo, '0' AS AltSerie, '0' AS AltModelo, N3_CCONTAB AS Conta, N1_ITEM AS Item, N1_CBASE AS CBase, N1.R_E_C_N_O_ AS SeqRecno FROM SN1010 N1 WITH (nolock) INNER JOIN SN3010 N3 WITH (nolock) ON N1_FILIAL = N3_FILIAL AND N1_CBASE = N3_CBASE AND N1_ITEM = N3_ITEM AND N1.D_E_L_E_T_ = '' AND N3.D_E_L_E_T_ = '' INNER JOIN CTT010 CT WITH (nolock) ON CTT_CUSTO = N3_CCUSTO AND CT.D_E_L_E_T_ = '') A
|
|
|