Uma dica pegue essa string sql execute-a no Query Analyser, vai ser mais
fácio de descobrir onde esta o erro.

Em 06/11/06, Nivaldo Stainle <[EMAIL PROTECTED]> escreveu:
>
> o banco é o SQL SERVER, com o BDE(TQuery) funciona agora quero criar o
> servidor de aplicação e usar o DBExpress, aí não funcionou.
>
>   Stainle
>
> Paulo Sérgio de Souza <[EMAIL PROTECTED]> escreveu:
>   Bom dia Stainle,
>
> Se o seu banco de dados for Firebird, substitua os substring(campo,x,x)
> por substring(campo from x order x).
>
> Espero ter ajudado,
>
> Paulo Sérgio
> Desenvolvedor
> BHte./MG
>
>   ----- Original Message -----
>   From: stainle2003
>   To: delphi-br@yahoogrupos.com.br
>   Sent: Monday, November 06, 2006 10:04 AM
>   Subject: [delphi-br] Erro SQL
>
>
>   usando o TQuery do Bde funciona; usando o TSQLDataSet do DBExpress
>   dá o seguinte erro:
>
>   SQL State : 42000,SQL Error Code: 170
>   Line 1: Incorrect syntax near ','.
>
>   não se arrumar este erro; o código está abaixo,
>   grato
>   Stainle
>
>   select substring(mat.tcodigo, 1, 3) as linha, mat.tiimes, mat.tiano,
>   sum(mat.ttotal) as Matriz,
>   (select  sum(f03.ttotal) from esif03 f03
>   where (substring(mat.tcodigo, 1, 3) = substring(f03.tcodigo, 1, 3))
>   and (mat.tiimes = f03.tiimes) and (mat.tiano = f03.tiano)
>   and (f03.tiopera = 2) and (f03.tihisto = 'S')) as Brasilia,
>   (select  sum(f04.ttotal) from esif04 f04
>   where (substring(mat.tcodigo, 1, 3) = substring(f04.tcodigo, 1, 3))
>   and (mat.tiimes = f04.tiimes) and (mat.tiano = f04.tiano)
>   and (f04.tiopera = 2) and (f04.tihisto = 'S')) as Poa,
>   (select  sum(f05.ttotal) from esif05 f05
>   where (substring(mat.tcodigo, 1, 3) = substring(f05.tcodigo, 1, 3))
>   and (mat.tiimes = f05.tiimes) and (mat.tiano = f05.tiano)
>   and (f05.tiopera = 2) and (f05.tihisto = 'S')) as Belo,
>   (select  sum(f06.ttotal) from esif06 f06
>   where (substring(mat.tcodigo, 1, 3) = substring(f06.tcodigo, 1, 3))
>   and (mat.tiimes = f06.tiimes) and (mat.tiano = f06.tiano)
>   and (f06.tiopera = 2) and (f06.tihisto = 'S')) as Curitiba,
>   (select  sum(f07.ttotal) from esif07 f07
>   where (substring(mat.tcodigo, 1, 3) = substring(f07.tcodigo, 1, 3))
>   and (mat.tiimes = f07.tiimes) and (mat.tiano = f07.tiano)
>   and (f07.tiopera = 2) and (f07.tihisto = 'S')) as SantaCata
>       from esimat mat
>   where (mat.tiimes = :pmes) and (mat.tiano = :pano) and (mat.tiopera =
>   2) and (mat.tihisto = 'S')
>   group by mat.tiimes, mat.tiano, substring(tcodigo, 1, 3)
>   order by linha
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
>
>
>   No virus found in this incoming message.
>   Checked by AVG Free Edition.
>   Version: 7.1.409 / Virus Database: 268.13.28/518 - Release Date:
> 04/11/2006
>
>
> [As partes desta mensagem que não continham texto foram removidas]
>
>
>
>
> ---------------------------------
> O Yahoo! está de cara nova. Venha conferir!
>
> [As partes desta mensagem que não continham texto foram removidas]
>
> 
>


[As partes desta mensagem que não continham texto foram removidas]



-- 
<<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>

<*> Para ver as mensagens antigas, acesse:
    http://br.groups.yahoo.com/group/delphi-br/messages

<*> Para falar com o moderador, envie um e-mail para:
    [EMAIL PROTECTED]
 
Links do Yahoo! Grupos

<*> Para visitar o site do seu grupo na web, acesse:
    http://br.groups.yahoo.com/group/delphi-br/

<*> Para sair deste grupo, envie um e-mail para:
    [EMAIL PROTECTED]

<*> O uso que você faz do Yahoo! Grupos está sujeito aos:
    http://br.yahoo.com/info/utos.html

 

Responder a