×
Linguagem de Programação ADVPL
Perguntas ERRO SINTAXE SQL
- Sombra
- Autor do Tópico
- Desconectado
- Membro Platina
Menos
Mais
- Postagens: 593
- Obrigados Recebidos: 1
11 anos 6 meses atrás #13984
por Sombra
ERRO SINTAXE SQL foi criado por Sombra
Boa tarde pessoal
ALGUEM PODERIA ME DAR UMA AJUDA NESSA no trecho dessa QUERY.
// Obtem os registros a serem processados
cQuery:=""
cQuery := "SELECT AF9_PROJET, " + c_eol
cQuery += "SUM(AF9_CUSTO) AS VLMPTOTA, " + c_eol
cQuery += "( SUM(AF9_CUSTO) / (POWER(" + STR(n_ftDiario) + "," + STR(mv_par08) + ")) ) AS VLMPREAL, " + c_eol
cQuery += "000000000000.00 AS VLTESTE" + c_eol
cQuery += "000000000000.00 AS VLSETERC" + c_eol
cQuery += "FROM " + RetSqlName("AF9")+" AF9 " + c_eol
cQuery += "WHERE AF9.D_E_L_E_T_ = ' '" + " AND AF9_EDTPAI = '04' AND AF9_CUSTO <> 0.00 AND" + c_eol
AO EXECUTAR O PROGRAMA O SISTEMA APRESENTA A SEGUINTE MENSAGEM DE ERRO:
THREAD ERROR (protheus01, FE-26) 17/05/2013 11:52:48
: Error : 102 (37000) (RC=-1) - [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '000000000000.00'. ( From tMSSQLConnection::GetQueryFile )
Thread ID [14868] User [Carlos GLM ] IO [1950] Tables [5] MaxTables [5] Comment [EBSER506 - TCPIP] Status [] SP [ ] Traced [No] InTran [No] DBEnv [MSSQL/P10TST] DBThread [(SPID: 311) ] Started [17/05/2013 11:52:17] LastIO [] IP [192.168.0.4] RCV [22772] SND [60118] TCBuild [20110603]
SELECT AF9_PROJET,SUM(AF9_CUSTO) AS VLMPTOTA,(SUM(AF9_CUSTO) / (POWER(1.00033173,60)) ) AS VLMPREAL,000000000000.00 AS VLTESTE 000000000000.00 AS VLSETERC FROM AF9010 AF9 WHERE AF9.D_E_L_E_T_ = ' ' AND AF9_EDTPAI = '04' AND AF9_CUSTO <> 0.00 AND AF9_PROJET IN (SELECT D2_PROJPMS FROM SD2010 SD2 WHERE SD2.D_E_L_E_T_ = ' ' AND RTRIM(D2_PROJPMS) <> ' ' AND RTRIM(D2_PROJPMS) <> 'SUCATA' AND D2_PROJPMS BETWEEN ' ' AND 'ZZZZZZZZZZ' AND D2_FILIAL BETWEEN '01' AND '01' AND D2_EMISSAO BETWEEN '20130501' AND '20130530' GROUP BY D2_PROJPMS ) GROUP BY AF9_PROJET UNION ALL SELECT AF9_PROJET,000000000000.00 AS VLMPTOTA,000000000000.00 AS VLMPREAL,SUM(AF9_CUSTO) AS VLTESTE 000000000000.00 AS VLSETERC FROM AF9010 AF9 WHERE AF9.D_E_L_E_T_ = ' ' AND AF9_EDTPAI = '05' AND RTRIM(AF9_TAREFA) = '05.01' AND AF9_CUSTO <> 0.00 AND AF9_PROJET IN (SELECT D2_PROJPMS FROM SD2010 SD2 WHERE SD2.D_E_L_E_T_ = ' ' AND RTRIM(D2_PROJPMS) <> ' ' AND RTRIM(D2_PROJPMS) <> 'SUCATA' AND D2_PROJPMS BETWEEN ' ' AND 'ZZZZZZZZZZ' AND D2_FILIAL BETWEEN '01' AND '01' AND D2_EMISSAO BETWEEN '20130501' AND '20130530' GROUP BY D2_PROJPMS ) GROUP BY AF9_PROJET UNION ALL SELECT AF9_PROJET,000000000000.00 AS VLMPTOTA,000000000000.00 AS VLMPREAL,000000000000.00 AS VLTESTE SUM(AF9_CUSTO) AS VLSETERC FROM AF9010 AF9 WHERE AF9.D_E_L_E_T_ = ' ' AND AF9_EDTPAI = '05' AND RTRIM(AF9_TAREFA) = '05.02' AND AF9_CUSTO <> 0.00 AND AF9_PROJET IN (SELECT D2_PROJPMS FROM SD2010 SD2 WHERE SD2.D_E_L_E_T_ = ' ' AND RTRIM(D2_PROJPMS) <> ' ' AND RTRIM(D2_PROJPMS) <> 'SUCATA' AND D2_PROJPMS BETWEEN ' on EBSE506P(EBSER506.PRW) 19/04/2013 12:25:20 line : 188
ALGUEM PODERIA ME DAR UMA AJUDA NESSA no trecho dessa QUERY.
// Obtem os registros a serem processados
cQuery:=""
cQuery := "SELECT AF9_PROJET, " + c_eol
cQuery += "SUM(AF9_CUSTO) AS VLMPTOTA, " + c_eol
cQuery += "( SUM(AF9_CUSTO) / (POWER(" + STR(n_ftDiario) + "," + STR(mv_par08) + ")) ) AS VLMPREAL, " + c_eol
cQuery += "000000000000.00 AS VLTESTE" + c_eol
cQuery += "000000000000.00 AS VLSETERC" + c_eol
cQuery += "FROM " + RetSqlName("AF9")+" AF9 " + c_eol
cQuery += "WHERE AF9.D_E_L_E_T_ = ' '" + " AND AF9_EDTPAI = '04' AND AF9_CUSTO <> 0.00 AND" + c_eol
AO EXECUTAR O PROGRAMA O SISTEMA APRESENTA A SEGUINTE MENSAGEM DE ERRO:
THREAD ERROR (protheus01, FE-26) 17/05/2013 11:52:48
: Error : 102 (37000) (RC=-1) - [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '000000000000.00'. ( From tMSSQLConnection::GetQueryFile )
Thread ID [14868] User [Carlos GLM ] IO [1950] Tables [5] MaxTables [5] Comment [EBSER506 - TCPIP] Status [] SP [ ] Traced [No] InTran [No] DBEnv [MSSQL/P10TST] DBThread [(SPID: 311) ] Started [17/05/2013 11:52:17] LastIO [] IP [192.168.0.4] RCV [22772] SND [60118] TCBuild [20110603]
SELECT AF9_PROJET,SUM(AF9_CUSTO) AS VLMPTOTA,(SUM(AF9_CUSTO) / (POWER(1.00033173,60)) ) AS VLMPREAL,000000000000.00 AS VLTESTE 000000000000.00 AS VLSETERC FROM AF9010 AF9 WHERE AF9.D_E_L_E_T_ = ' ' AND AF9_EDTPAI = '04' AND AF9_CUSTO <> 0.00 AND AF9_PROJET IN (SELECT D2_PROJPMS FROM SD2010 SD2 WHERE SD2.D_E_L_E_T_ = ' ' AND RTRIM(D2_PROJPMS) <> ' ' AND RTRIM(D2_PROJPMS) <> 'SUCATA' AND D2_PROJPMS BETWEEN ' ' AND 'ZZZZZZZZZZ' AND D2_FILIAL BETWEEN '01' AND '01' AND D2_EMISSAO BETWEEN '20130501' AND '20130530' GROUP BY D2_PROJPMS ) GROUP BY AF9_PROJET UNION ALL SELECT AF9_PROJET,000000000000.00 AS VLMPTOTA,000000000000.00 AS VLMPREAL,SUM(AF9_CUSTO) AS VLTESTE 000000000000.00 AS VLSETERC FROM AF9010 AF9 WHERE AF9.D_E_L_E_T_ = ' ' AND AF9_EDTPAI = '05' AND RTRIM(AF9_TAREFA) = '05.01' AND AF9_CUSTO <> 0.00 AND AF9_PROJET IN (SELECT D2_PROJPMS FROM SD2010 SD2 WHERE SD2.D_E_L_E_T_ = ' ' AND RTRIM(D2_PROJPMS) <> ' ' AND RTRIM(D2_PROJPMS) <> 'SUCATA' AND D2_PROJPMS BETWEEN ' ' AND 'ZZZZZZZZZZ' AND D2_FILIAL BETWEEN '01' AND '01' AND D2_EMISSAO BETWEEN '20130501' AND '20130530' GROUP BY D2_PROJPMS ) GROUP BY AF9_PROJET UNION ALL SELECT AF9_PROJET,000000000000.00 AS VLMPTOTA,000000000000.00 AS VLMPREAL,000000000000.00 AS VLTESTE SUM(AF9_CUSTO) AS VLSETERC FROM AF9010 AF9 WHERE AF9.D_E_L_E_T_ = ' ' AND AF9_EDTPAI = '05' AND RTRIM(AF9_TAREFA) = '05.02' AND AF9_CUSTO <> 0.00 AND AF9_PROJET IN (SELECT D2_PROJPMS FROM SD2010 SD2 WHERE SD2.D_E_L_E_T_ = ' ' AND RTRIM(D2_PROJPMS) <> ' ' AND RTRIM(D2_PROJPMS) <> 'SUCATA' AND D2_PROJPMS BETWEEN ' on EBSE506P(EBSER506.PRW) 19/04/2013 12:25:20 line : 188
Por favor Acessar ou Registrar para participar da conversa.
- kanaamlrr
- Desconectado
- Membro Platina
Menos
Mais
- Postagens: 1576
- Obrigados Recebidos: 4
11 anos 6 meses atrás - 11 anos 6 meses atrás #13988
por kanaamlrr
Respondido por kanaamlrr no tópico ERRO SINTAXE SQL
faltou uma vírugla ali
cQuery:=""
cQuery := "SELECT AF9_PROJET, " + c_eol
cQuery += "SUM(AF9_CUSTO) AS VLMPTOTA, " + c_eol
cQuery += "( SUM(AF9_CUSTO) / (POWER(" + STR(n_ftDiario) + "," + STR(mv_par08) + ")) ) AS VLMPREAL, " + c_eol
cQuery += "000000000000.00 AS VLTESTE,<---AQUI " + c_eol
cQuery += "000000000000.00 AS VLSETERC" + c_eol
cQuery += "FROM " + RetSqlName("AF9")+" AF9 " + c_eol
cQuery += "WHERE AF9.D_E_L_E_T_ = ' '" + " AND AF9_EDTPAI = '04' AND AF9_CUSTO <> 0.00 AND" + c_eol
cQuery:=""
cQuery := "SELECT AF9_PROJET, " + c_eol
cQuery += "SUM(AF9_CUSTO) AS VLMPTOTA, " + c_eol
cQuery += "( SUM(AF9_CUSTO) / (POWER(" + STR(n_ftDiario) + "," + STR(mv_par08) + ")) ) AS VLMPREAL, " + c_eol
cQuery += "000000000000.00 AS VLTESTE,<---AQUI " + c_eol
cQuery += "000000000000.00 AS VLSETERC" + c_eol
cQuery += "FROM " + RetSqlName("AF9")+" AF9 " + c_eol
cQuery += "WHERE AF9.D_E_L_E_T_ = ' '" + " AND AF9_EDTPAI = '04' AND AF9_CUSTO <> 0.00 AND" + c_eol
Ultima edição: 11 anos 6 meses atrás por kanaamlrr.
Por favor Acessar ou Registrar para participar da conversa.
- Sombra
- Autor do Tópico
- Desconectado
- Membro Platina
Menos
Mais
- Postagens: 593
- Obrigados Recebidos: 1
Tempo para a criação da página:0.095 segundos