[DUG] Drop table in Interbase

Jeremy North jeremy.north at gmail.com
Wed Jun 17 11:33:30 NZST 2009


Well you need to test if the select actually returned any records before
calling the drop table. All possible with SQL.

I see a bit of research in your future :-)

On Wed, Jun 17, 2009 at 7:58 AM, Jeremy Coulter <jscoulter at gmail.com> wrote:

> Thansk for your reply edward. However, I dont normall use Interbase and
> your example didnt make a lot of sence. I managed to find a similar example
> but I dont follow part of it.
>
> when I run :
>
> select * from rdb$relations WHERE RDB$RELATION_NAME = 'MyTable'
> and
> DROP TABLE MyTable;
> COMMIT;
>
> It tells me DROP is an invalid token. So I assume the "And" is not part of
> the SQL statement.
> So what I dont follow is, just doing a "SELECT" to see if a record exists
> then dropping the table seems like something is missing.
>
> in a programming sense, I would expect something like
>
> IF select * from rdb$relations WHERE RDB$RELATION_NAME = 'MyTable'  <> ''
> then
> DROP TABLE MyTable;
>
> I know thats not real code, but my point is, just because I can do a
> select, doesnt tell me if the table exists or not to try to delete
> it.......I hope you follow what I am meaning.
>
> Jeremy
>
>
>
> On Tue, Jun 16, 2009 at 4:05 PM, John Bird <johnkbird at paradise.net.nz>wrote:
>
>>  For a good working example see
>>
>> http://xkcd.com/327/
>>
>> (Standard disclaimer - do not try this at home!)
>>
>> John
>>
>> ----- Original Message -----
>>
>>  *From:* Jeremy Coulter <jscoulter at gmail.com>
>> *To:* NZ Borland Developers Group - Delphi List <delphi at delphi.org.nz>
>>   *Sent:* Tuesday, June 16, 2009 3:35 PM
>> *Subject:* Re: [DUG] Drop table in Interbase
>>
>> ok cool I will try that.
>>
>> Thanks, Jeremy
>>
>> On Tue, Jun 16, 2009 at 2:54 PM, Edward Koryagin <ed_iv2001 at yahoo.co.nz>wrote:
>>
>>>
>>> select * from rdb$relations ...
>>> and
>>> DROP TABLE ....
>>> Edward Koryagin
>>>
>>>
>>> --- On Tue, 16/6/09, Jeremy Coulter <jscoulter at gmail.com> wrote:
>>>
>>> > From: Jeremy Coulter <jscoulter at gmail.com>
>>> > Subject: [DUG] Drop table in Interbase
>>> > To: "NZ Borland Developers Group - Delphi List" <delphi at delphi.org.nz>
>>> > Received: Tuesday, 16 June, 2009, 1:31 PM
>>>  > Hi all.
>>> > In interbase, how do I drop a table if it already exists?
>>> > I want to check for a table exists and if it does exist,
>>> > drop it.
>>> >
>>> > I have Googled, but I cant seem to find anything. I am
>>> > prob. searching wrong :-)
>>> >
>>> >
>>> > Jeremy
>>> >
>>> >
>>> > -----Inline Attachment Follows-----
>>> >
>>> > _______________________________________________
>>> > NZ Borland Developers Group - Delphi mailing list
>>> > Post: delphi at delphi.org.nz
>>> > Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>> > Unsubscribe: send an email to delphi-request at delphi.org.nz
>>> > with Subject: unsubscribe
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> NZ Borland Developers Group - Delphi mailing list
>>> Post: delphi at delphi.org.nz
>>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
>>> unsubscribe
>>>
>>
>>  ------------------------------
>>
>> _______________________________________________
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi at delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
>> unsubscribe
>>
>>
>> _______________________________________________
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi at delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
>> unsubscribe
>>
>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20090617/a8a53949/attachment.html 


More information about the Delphi mailing list