Olá amigos, Eu uma instrução SQL bem simples que qdo crio a query em tempo
de execução a mesma acrescenta uns caracteres estranhos no final da String e
ocaciona o erro qdo executo o comando OPEN.

Alguém já passou por isso ou tem uma dica de como resolver este problema ??

Seque texto captura do Query.Sql.text

'select '< 1' as Faixa_Etaria,sum(qtd), co_municipio_ibge_residencia, ano
'#$D#$A'from (select count(*) as
qtd,co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY') as
ano,'#$D#$A'EXTRACT(year FROM age (dt_obito, dt_nascimento)) as faixa_etaria
'#$D#$A'from dbsim.tb_do where to_char(dt_obito, 'YYYY') = '2007' and
a.co_municipio_ibge_residencia = '330010''#$D#$A'group by
co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY'),EXTRACT(year FROM age
(dt_obito, dt_nascimento))'#$D#$A'order by faixa_etaria ) as
faixa'#$D#$A'where faixa.faixa_etaria < 1'#$D#$A'group by
faixa.co_municipio_ibge_residencia, faixa.ano'#$D#$A'union'#$D#$A'select
'1-4' as Faixa_Etaria,sum(qtd), co_municipio_ibge_residencia, ano
'#$D#$A'from (select count(*) as
qtd,co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY') as
ano,'#$D#$A'EXTRACT(year FROM age (dt_obito, dt_nascimento)) as faixa_etaria
'#$D#$A'from dbsim.tb_do where to_char(dt_obito, 'YYYY') = '2007' and
a.co_municipio_ibge_residencia = '330010''#$D#$A'group by
co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY'),EXTRACT(year FROM age
(dt_obito, dt_nascimento))'#$D#$A'order by faixa_etaria ) as
faixa'#$D#$A'where faixa.faixa_etaria between 1 and 4'#$D#$A'group by
faixa.co_municipio_ibge_residencia, faixa.ano'#$D#$A'union'#$D#$A'select
'5-9' as Faixa_Etaria,sum(qtd), co_municipio_ibge_residencia, ano
'#$D#$A'from (select count(*) as
qtd,co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY') as
ano,'#$D#$A'EXTRACT(year FROM age (dt_obito, dt_nascimento)) as faixa_etaria
'#$D#$A'from dbsim.tb_do where to_char(dt_obito, 'YYYY') = '2007' and
a.co_municipio_ibge_residencia = '330010''#$D#$A'group by
co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY'),EXTRACT(year FROM age
(dt_obito, dt_nascimento))'#$D#$A'order by faixa_etaria ) as
faixa'#$D#$A'where faixa.faixa_etaria between 5 and 9'#$D#$A'group by
faixa.co_municipio_ibge_residencia, faixa.ano'#$D#$A'union'#$D#$A'select
'10-14' as Faixa_Etaria,sum(qtd), co_municipio_ibge_residencia, ano
'#$D#$A'from (select count(*) as
qtd,co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY') as
ano,'#$D#$A'EXTRACT(year FROM age (dt_obito, dt_nascimento)) as faixa_etaria
'#$D#$A'from dbsim.tb_do where to_char(dt_obito, 'YYYY') = '2007' and
a.co_municipio_ibge_residencia = '330010''#$D#$A'group by
co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY'),EXTRACT(year FROM age
(dt_obito, dt_nascimento))'#$D#$A'order by faixa_etaria ) as
faixa'#$D#$A'where faixa.faixa_etaria between 10 and 14'#$D#$A'group by
faixa.co_municipio_ibge_residencia, faixa.ano'#$D#$A'union'#$D#$A'select
'15-19' as Faixa_Etaria,sum(qtd), co_municipio_ibge_residencia, ano
'#$D#$A'from (select count(*) as
qtd,co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY') as
ano,'#$D#$A'EXTRACT(year FROM age (dt_obito, dt_nascimento)) as faixa_etaria
'#$D#$A'from dbsim.tb_do where to_char(dt_obito, 'YYYY') = '2007' and
a.co_municipio_ibge_residencia = '330010''#$D#$A'group by
co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY'),EXTRACT(year FROM age
(dt_obito, dt_nascimento))'#$D#$A'order by faixa_etaria ) as
faixa'#$D#$A'where faixa.faixa_etaria between 15 and 19'#$D#$A'group by
faixa.co_municipio_ibge_residencia, faixa.ano'#$D#$A'union'#$D#$A'select
'20-29' as Faixa_Etaria,sum(qtd), co_municipio_ibge_residencia, ano
'#$D#$A'from (select count(*) as
qtd,co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY') as
ano,'#$D#$A'EXTRACT(year FROM age (dt_obito, dt_nascimento)) as faixa_etaria
'#$D#$A'from dbsim.tb_do where to_char(dt_obito, 'YYYY') = '2007' and
a.co_municipio_ibge_residencia = '330010''#$D#$A'group by
co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY'),EXTRACT(year FROM age
(dt_obito, dt_nascimento))'#$D#$A'order by faixa_etaria ) as
faixa'#$D#$A'where faixa.faixa_etaria between 20 and 29'#$D#$A'group by
faixa.co_municipio_ibge_residencia, faixa.ano'#$D#$A'union'#$D#$A'select
'30-39' as Faixa_Etaria,sum(qtd), co_municipio_ibge_residencia, ano
'#$D#$A'from (select count(*) as
qtd,co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY') as
ano,'#$D#$A'EXTRACT(year FROM age (dt_obito, dt_nascimento)) as
faixa_etaria'#$D#$A'from dbsim.tb_do where to_char(dt_obito, 'YYYY') =
'2007' and a.co_municipio_ibge_residencia = '330010''#$D#$A'group by
co_municipio_ibge_residencia,to_char(dt_obito, 'YYYY'),EXTRACT(year FROM age
(dt_obito, dt_nascimento))'#$D#$A'order by faixa_etaria ) as
faixa'#$D#$A'where faixa.faixa_etaria between 30 and
39'#$D#$A'group`'#$1A'u'#$A#8#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'x(u'#0'h|Ñ'#8#0#0#0#0#8#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#$1C'$u'#0#$10'^Ñ'#8'à'#5'u'#$A#8#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'x'#$16'u'#0'p]Ñ'#8'
'#0'u'#$A#8#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'œ"u'#0'ä\Ñ'#8#0#$1C'u'#$A#8#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#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0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'
%u'#0'ì¯'#$13#8'€'#5'u'#$A#8#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'œ'#$1D'u'#0'€°'#$13#8'À'#0'u'#$A#8#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'
!u'#0'´(R)'#$13#8'€'#$E'u'#$A#8#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0


Att,

Jorge Ericsson S. Pinheiro
Ericsson Sistemas e Soluções
(61) 3797-4785 / 3244-8689 / 9227 4785
http://www.jericsson.com.br
jericsson...@gmail.com
jericsson...@hotmail.com
skype:jericsson
Brasília - DF


[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:
    delphi-br-ow...@yahoogrupos.com.br
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:
    delphi-br-unsubscr...@yahoogrupos.com.br

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


Responder a