Link to home
Start Free TrialLog in
Avatar of waelolabi
waelolabi

asked on

About View In Sql

How Can I Make A View For My Table Using Sql
And Select Fields From This View From Another Query
Avatar of geobul
geobul

Hi,

If you are talking about MS SQL then:
1. Use CREATE VIEW statement

with ADOQuery1 do begin
  Close;
  SQL.Clear;
  SQL.Add('CREATE VIEW MyView AS');
  SQL.Add('SELECT Field1, Field2 FROM Table1');
  ExecSQL;
end;

2. Use the already created view as regular table

with ADOQuery2 do begin
  Close;
  SQL.Clear;
  SQL.Add('SELECT * FROM MyView');
  Open;
  // do something here
  Close;
end;

Regards, Geo
Avatar of waelolabi

ASKER

My Dear
I Am Using A Paradox Tabels
So I Am Using BDE Query In My Project
And This Code Did Not Work On BDE Query
And I Have The Following Error Message : "Cabapility Not Support"

What Is The Solution
How Can I Make A View In This Case

And Thanks For Your Help
Would you explain what you understand as 'view' in paradox? As far as I know there is no such thing. I said that my code above is for MSSQL server.
Hi geobul
Thanks For Your Help
Your Code Is Perfect And Working Very Well In Acsess Database
(Ado Components in Delphi)
But As I Said:
I Am Using Paradox7 Database (BDE Components In Delphi)
And Your Code Is Not Working On This Database

Hope You Understand Me
Waiting Your Reply Please
Again: Would you explain what you understand as 'view' in paradox? As far as I know there is no such thing.
ASKER CERTIFIED SOLUTION
Avatar of geobul
geobul

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi geobul
I Will Try You Final Soulution I Hope It Is Ok

About View In Paradox I Meant Using Sql (Creat View Command) on Paradox7 Database Using BDE Component In Delphi6 (Tquery)
Rather Than Ado Component (Tadoquery)
Hi,

There is no difference whether you'll use TQuery or TADOQuery. The problem is if Paradox supports CREATE VIEW command. I think it doesn't. That's why I proposed creating a new table instead.

Regards, Geo
Please What Is Th Name Of The Sql Language That We Use In Delphi
Is It (MsSql, Sql Server ........... etc)
thanks
If you have MSSQL server then you'll use MS Transact SQL, if you connect to Oracle then you'll use Oracle's SQL etc. Delphi passes SQL statements to the SQL server you are connected to.