Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

About View In Sql

Posted on 2003-11-13
10
Medium Priority
?
353 Views
Last Modified: 2013-11-23
How Can I Make A View For My Table Using Sql
And Select Fields From This View From Another Query
0
Comment
Question by:waelolabi
  • 6
  • 4
10 Comments
 
LVL 17

Expert Comment

by:geobul
ID: 9746071
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
0
 

Author Comment

by:waelolabi
ID: 9747178
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
0
 
LVL 17

Expert Comment

by:geobul
ID: 9747365
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.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:waelolabi
ID: 9751932
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
0
 
LVL 17

Expert Comment

by:geobul
ID: 9753462
Again: Would you explain what you understand as 'view' in paradox? As far as I know there is no such thing.
0
 
LVL 17

Accepted Solution

by:
geobul earned 150 total points
ID: 9753473
A possible solution could be:

1. using CREATE TABLE statement create a new empty table with the desired structure

CREATE TABLE "MyView.db"
(
  custno NUMERIC(10,2),
  company CHAR(20)
)

2. using INSERT INTO statement with SELECT inside fill that table:

INSERT INTO "MyView.db"
(custno, company)
SELECT custno, company
FROM "customer.db" WHERE custno > 100

3. use MyView as a regular table in another query

4. when you don't need it anymore execute
DROP TABLE "MyView.db"

Regards, Geo
0
 

Author Comment

by:waelolabi
ID: 9776926
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)
0
 
LVL 17

Expert Comment

by:geobul
ID: 9777045
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
0
 

Author Comment

by:waelolabi
ID: 9785534
Please What Is Th Name Of The Sql Language That We Use In Delphi
Is It (MsSql, Sql Server ........... etc)
thanks
0
 
LVL 17

Expert Comment

by:geobul
ID: 9789405
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question