Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 701099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:34:19+00:00 2026-05-14T03:34:19+00:00

How i can parse and extract the parameters from an SQL Query using delphi?

  • 0

How i can parse and extract the parameters from an SQL Query using delphi?

example :

from this query

SELECT * FROM MyTable 
WHERE Field1=:Param1 
AND Field2=:Param2 
AND (Field3=:Param3 OR Field4=:Param4)

i want to obtain

Param1
Param2
Param3
Param4

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:34:19+00:00Added an answer on May 14, 2026 at 3:34 am

    @Salvador, you can use the TParams.ParseSQL function to get the parameters.

    see this simple code

    program Project241;
    
    {$APPTYPE CONSOLE}
    
    uses
      db, //for use TParams
      Classes,// 
      SysUtils;
    
    procedure GetParamsFromSQL(SQL:string;Const ListParams:TStrings);
    var
      ParamList: TParams;
      i: integer;
    begin
     ListParams.Clear;//Clear the list
        ParamList := TParams.Create(nil);
        try
          ParamList.ParseSQL(SQL, True); //Force to create the params from the SQL
          for i := 0 to ParamList.Count - 1 do 
            ListParams.Add(ParamList[i].Name);
        finally
        ParamList.Free;
        end;
    end;
    
    var
      ParamList : TStrings;
    begin
      ParamList:=TStringList.Create;
      try
        GetParamsFromSQL('SELECT * FROM MyTable WHERE Field1=:Param1 AND Field2=:Param2 AND (Field3=:Param3 OR Field4=:Param4)',ParamList);
        Writeln(ParamList.text);
        Readln;
      finally
      ParamList.Free;
      end;
    end.
    

    returns :

    Param1
    Param2
    Param3
    Param4
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I parse a mailto request ? 'mailto:someone@example.com?cc=someone_else@example.com&subject=This%20is%20the%20subject&body=This%20is%20the%20body' From this NSURL, I want
How can one parse HTML/XML and extract information from it?
I'm looking for a parser that can extract methods from a java class (static
I'm using RSS library so i can parse Atom and RSS in Ruby and
Is there any tool that can parse/conver xml files to this format? I have
Given a MIME string, how can I parse it to extract the charset? And
I can successfully parse the contents of a JSON file, using the JSON-Framework 3.0,
Possible Duplicate: Ruby code to extract host from URL string I found this module
We have a need to parse and extract the content from html files. We
I have some code that I parse and extract some matrices from. Theses matrices

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.