| View previous topic :: View next topic |
| Author |
Message |
Bennie Coetzer Guest
|
Posted: Tue Mar 15, 2005 3:33 pm Post subject: Table exists in SQL |
|
|
Hi
How do I determine if a table exists in a database using SQL? I am
using Interbase with DBExpress.
regards
Bennie
|
|
| Back to top |
|
 |
Craig Stuntz [TeamB] Guest
|
Posted: Tue Mar 15, 2005 5:07 pm Post subject: Re: Table exists in SQL |
|
|
Bennie Coetzer wrote:
| Quote: | How do I determine if a table exists in a database using SQL? I am
using Interbase with DBExpress.
|
SELECT
'Yes, it exists'
FROM
RDB$RELATIONS
WHERE
RDB$RELATION_NAME = :TableName
This returns, "Yes, it exists" if the table (or view) exists and
nothing if it doesn't.
--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Want to help make Delphi and InterBase better? Use QC!
http://qc.borland.com -- Vote for important issues
|
|
| Back to top |
|
 |
Bennie Coetzer Guest
|
Posted: Thu Mar 17, 2005 7:37 pm Post subject: Re: Table exists in SQL |
|
|
Thanks Craig,
I should have asked how do I do this from Delphi7?
regards
Bennie
Craig Stuntz [TeamB] wrote:
| Quote: | Bennie Coetzer wrote:
How do I determine if a table exists in a database using SQL? I am
using Interbase with DBExpress.
SELECT
'Yes, it exists'
FROM
RDB$RELATIONS
WHERE
RDB$RELATION_NAME = :TableName
This returns, "Yes, it exists" if the table (or view) exists and
nothing if it doesn't.
|
|
|
| Back to top |
|
 |
Craig Stuntz [TeamB] Guest
|
Posted: Thu Mar 17, 2005 7:58 pm Post subject: Re: Table exists in SQL |
|
|
Bennie Coetzer wrote:
| Quote: | I should have asked how do I do this from Delphi7?
|
Am I missing something? You just run that query.
--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Please read and follow Borland's rules for the user of their
news server: http://info.borland.com/newsgroups/guide.html
|
|
| Back to top |
|
 |
|