in one sql: if exists( select * from rdb$relations where Upper(RDB$RELATION_NAME) = (''MYTABLE'') THEN DROP TABLE MYTABLE
My be we need begin ... end - I don't work with Interbase for a while... Cheers, Edward Koryagin --- On Wed, 17/6/09, Jeremy Coulter <jscoul...@gmail.com> wrote: > From: Jeremy Coulter <jscoul...@gmail.com> > Subject: Re: [DUG] Drop table in Interbase > To: "NZ Borland Developers Group - Delphi List" <delphi@delphi.org.nz> > Received: Wednesday, 17 June, 2009, 9:58 AM > 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 <johnkb...@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 > To: > NZ Borland > Developers Group - Delphi > List > > 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_iv2...@yahoo.co.nz> > > wrote: > > > select * > from rdb$relations ... > and > DROP TABLE .... > Edward > Koryagin > > > --- On Tue, 16/6/09, Jeremy Coulter <jscoul...@gmail.com> > > wrote: > > > From: Jeremy Coulter <jscoul...@gmail.com> > > > Subject: [DUG] Drop table in Interbase > > To: "NZ Borland Developers > Group - Delphi List" <delphi@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@delphi.org.nz > > Admin: > http://delphi.org.nz/mailman/listinfo/delphi > > > Unsubscribe: send an email to delphi-requ...@delphi.org.nz > > > with Subject: > unsubscribe > > > > > _______________________________________________ > NZ > Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > > Unsubscribe: > send an email to delphi-requ...@delphi.org.nz > > with Subject: unsubscribe > > > > > > _______________________________________________ > NZ Borland > Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: > http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to > delphi-requ...@delphi.org.nz > with Subject: > unsubscribe > > _______________________________________________ > > NZ Borland Developers Group - Delphi mailing list > > Post: delphi@delphi.org.nz > > Admin: http://delphi.org.nz/mailman/listinfo/delphi > > Unsubscribe: send an email to delphi-requ...@delphi.org.nz > with Subject: unsubscribe > > > > -----Inline Attachment Follows----- > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@delphi.org.nz > with Subject: unsubscribe _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe