[firebase-br] Usar Like ou o que?

Andrei Luís compuvale.software em gmail.com
Qua Jul 4 18:10:03 -03 2007


Ao invés de usar %algumacoisa%  você pode utilizar o CONTAINING.

E ao invés do algumacoisa% você pode utilizar o STARTING WITH.

[]
Andrei

Em 04/07/07, Zottis<zottissistemas em brturbo.com.br> escreveu:
> Pessoal, li que não se deve usar o comando like pois pode deixar lento a
> pesquisa, mas como faria este comando,
> estou mandando do jeito que faço, até agora não está tão lento, mas já está
> pesando dependendo do período escolhido, para evitar futuros aborrecimentos
> estou querendo mudar o sistema de pesquisas do meu sistema.
>
> Obrigado
>
>       if RadioRazaoSocial.Checked=true then
>         begin
>         Screen.Cursor := crSQLWait;
>         BuscaSrc.DataSe t:= nil;
>         With Busca do
>             begin
>                 Close;
>                 SQL.Clear;
>                 SQL.Add('select  Pedidos.Total, Pedidos.USUARIONO,
> Pedidos.FORMAPGTONO,Pedidos.ADIANTAMENTOS, Pedidos.Entregue,
> Pedidos.EntregueDia,');
>                 SQL.Add('Pedidos.Comprador, Pedidos.TOTALITENS,
> Pedidos.Desconto,Pedidos.JurosTaxa, Pedidos.PedidoNo, Pedidos.Data,');
>                 SQL.Add('Pedidos.Despacho, Pedidos.Prometido,
> Pedidos.EnderecoEntrega,Pedidos.ClienteNo,Pedidos.TotalPago,Pedidos.TotalDescontos,Pedidos.Lojano,
> Pedidos.TOTAL_QUANTIA,');
>                 SQL.Add('clientes.clienteno,Clientes.RazaoSocial as
> clienteRS,Clientes.NomeFantasia as clienteNF');
>                 SQL.Add('From Pedidos,Clientes');
>                 SQL.Add('Where Pedidos.ClienteNo = Clientes.ClienteNo and
> Pedidos.Lojano Like(:VarLojaNo)and');
>                 SQL.Add('(Pedidos.entregue) like(:VarEntregue) and');
>                   If RadioGroupOrdenar.ItemIndex = 0 then
>                     begin
>                      SQL.Add('Pedidos.Data between :VarDataI and :VarDataF
> and');
>                     end else
>                   If RadioGroupOrdenar.ItemIndex = 1 then
>                     begin
>                      SQL.Add('Pedidos.Prometido between :VarDataI and
> :VarDataF and');
>                     end else
>                   If RadioGroupOrdenar.ItemIndex = 2 then
>                     begin
>                       SQL.Add('Pedidos.Prometido between :VarDataI and
> :VarDataF and');
>                     end;
>                 SQL.Add('Upper(Clientes.RazaoSocial) Like Upper(:VarNome)');
>                    if RadioGroupOrdenar.ItemIndex = 0 then
>                    begin
>                    SQL.Add('Order by
> Pedidos.Data,Pedidos.Prometido,Pedidos.PedidoNo');
>                    end else
>                    if RadioGroupOrdenar.ItemIndex = 1 then
>                    begin
>                    SQL.Add('Order by
> Pedidos.Prometido,Pedidos.Data,Pedidos.PedidoNo');
>                    end else
>                    if RadioGroupOrdenar.ItemIndex = 2 then
>                    begin
>                    SQL.Add('Order by
> Pedidos.PedidoNo,Pedidos.Data,Pedidos.Prometido');
>                    end;
>            ParamByName('VarDataI').AsDate:=Data1.Date;
>            ParamByName('VarDataF').AsDate:=Data2.Date;
>            ParamByName('VarNome').AsString:='%'+Edit1.Text+'%';
>          if Editlojano.Text <>''then
>           begin
>            ParamByName('VarLojaNo').AsString := EditLojaNo.Text;
>           end else
>          if Editlojano.Text = ''then
>           begin
>            ParamByName('VarLojaNo').AsString:='%';
>           end;
>         if RadioGroup1.ItemIndex = 0 then
>           begin
>         ParamByName('VarEntregue').AsString:='%';
>            end;
>         if RadioGroup1.ItemIndex = 1 then
>           begin
>         ParamByName('VarEntregue').AsString:='S';
>            end;
>         if RadioGroup1.ItemIndex = 2 then
>            begin
>         ParamByName('VarEntregue').AsString:='N';
>            end;
>            Prepare;
>            Open;
>            end;
>            Somar_o_Pedido;
>         BuscaSrc.DataSet:=Busca;
>         Screen.Cursor:=crDefault;
>         end else
>




Mais detalhes sobre a lista de discussão lista