SQL does-table-exist? (was Re: [V4RB] SQL "Create Table")

Erik Mueller-Harder lists at praxisworks.com
Tue Mar 11 14:33:24 CST 2003


On Tuesday, March 11, 2003, Fred.Stephenson wrote:

>> I wanted to find out whether a particular table exists already in
>> the database.  Isn't checking the sysItem table the best way to do
>> this?  What would be a better way?
> 
> well I suppose you could do
> if mydb.baseobject("tablename")= nil then
> // whatever
> else
> //whatever
> end if

Yes, thanks.  That's what I've done in past projects with Rb and Valentina -- it works fine.

For several unrelated reasons, I'm trying to do everything possible with SQL calls, though.  What is the best way to find out whether a table exists (or doesn't exist) in a database via SQL?

I had thought a simple inquiry of the SysItem table (VKernal documentation, page 15) would be the ticket -- and it seems to work fine.  Ruslan sounds concerned about it though.  Any other thoughts?

Ruslan, you say "This is not safe and good way."  Is it not OK to perform inquiries on the system tables?

Thanks,

Erik


More information about the Valentina mailing list