[MonetDB-users] DROP TABLE IF EXISTS <table>;
Hello,
I want to prevent an SQLException from occurring for tables that do not exist in my database. For example: sql>DROP TABLE "locked"; SQLException:sql.catalog:DROP TABLE: no such table 'locked'
It seems (and is documented) that there is no such thing like "IF EXISTS" in MonetDB. Is there a way to circumvent the SQLException?
Mike
On 30-03-2011 16:41:15 +0300, Michael Sioutis wrote:
I want to prevent an SQLException from?occurring?for tables that do not exist in my database.
For example:
sql>DROP TABLE "locked";
SQLException:sql.catalog:DROP TABLE: no such table 'locked'
It seems (and is documented) that there is no such thing like "IF EXISTS" in MonetDB.
Is there a way to circumvent the SQLException?
no.
However, you could just check if the table exists by looking it up with a query, if that helps you from your application.
Mike,
may I ask why you want to drop a table that does not exist?
Stefan
On Wed, Mar 30, 2011 at 04:41:15PM +0300, Michael Sioutis wrote:
Hello,
I want to prevent an SQLException from occurring for tables that do not exist in my database. For example: sql>DROP TABLE "locked"; SQLException:sql.catalog:DROP TABLE: no such table 'locked'
It seems (and is documented) that there is no such thing like "IF EXISTS" in MonetDB. Is there a way to circumvent the SQLException?
Mike
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar
MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
Because somepeople have scripts that clean up, and dont want these parts to run outside a transaction?
Stefan
Op 30 mrt 2011 om 15:53 heeft Stefan.Manegold@cwi.nl het volgende geschreven:\
Mike,
may I ask why you want to drop a table that does not exist?
Stefan
On Wed, Mar 30, 2011 at 04:41:15PM +0300, Michael Sioutis wrote:
Hello,
I want to prevent an SQLException from occurring for tables that do not exist in my database. For example: sql>DROP TABLE "locked"; SQLException:sql.catalog:DROP TABLE: no such table 'locked'
It seems (and is documented) that there is no such thing like "IF EXISTS" in MonetDB. Is there a way to circumvent the SQLException?
Mike
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar
MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- | Stefan.Manegold @ CWI.nl | DB Architectures (INS1) | | http://CWI.nl/~manegold/ | Science Park 123 (L321) | | Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
Well yes, actually I don't want to deal with an SQLException in my code. Having an SQL query (SELECT name FROM tables WHERE name like 'table_I_want_to_drop';) to see if the table is there as Fabian suggested and then move on to dropping it if it exists by checking the results of the query, works for me.
I was trying to find out if there is a single SQL query that would do that like for example in Ms SQL, but reading a bit the documentation of MonetDB I couldn't come up with sth.
Mike
On Wed, Mar 30, 2011 at 4:55 PM, Stefan de Konink stefan@konink.de wrote:
Because somepeople have scripts that clean up, and dont want these parts to run outside a transaction?
Stefan
Op 30 mrt 2011 om 15:53 heeft Stefan.Manegold@cwi.nl het volgende geschreven:\
Mike,
may I ask why you want to drop a table that does not exist?
Stefan
On Wed, Mar 30, 2011 at 04:41:15PM +0300, Michael Sioutis wrote:
Hello,
I want to prevent an SQLException from occurring for tables that do not exist in my database. For example: sql>DROP TABLE "locked"; SQLException:sql.catalog:DROP TABLE: no such table 'locked'
It seems (and is documented) that there is no such thing like "IF EXISTS" in MonetDB. Is there a way to circumvent the SQLException?
Mike
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar
MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- | Stefan.Manegold @ CWI.nl | DB Architectures (INS1) | | http://CWI.nl/~manegold/ | Science Park 123 (L321) | | Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
Well yes, actually I don't want to deal with an SQLException in my code. Having an SQL query (SELECT name FROM tables WHERE name like 'table_I_want_to_drop';) to see if the table is there as Fabian suggested and then move on to dropping it if it exists by checking the results of the query, works for me.
I was trying to find out if there is a single SQL query that would do that like for example in Ms SQL, but reading a bit the documentation of MonetDB I couldn't come up with sth.
Mike
On Wed, Mar 30, 2011 at 4:55 PM, Stefan de Konink stefan@konink.de wrote:
Because somepeople have scripts that clean up, and dont want these parts to run outside a transaction?
Stefan
Op 30 mrt 2011 om 15:53 heeft Stefan.Manegold@cwi.nl het volgende geschreven:\
Mike,
may I ask why you want to drop a table that does not exist?
Stefan
On Wed, Mar 30, 2011 at 04:41:15PM +0300, Michael Sioutis wrote:
Hello,
I want to prevent an SQLException from occurring for tables that do not exist in my database. For example: sql>DROP TABLE "locked"; SQLException:sql.catalog:DROP TABLE: no such table 'locked'
It seems (and is documented) that there is no such thing like "IF EXISTS" in MonetDB. Is there a way to circumvent the SQLException?
Mike
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar
MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- | Stefan.Manegold @ CWI.nl | DB Architectures (INS1) | | http://CWI.nl/~manegold/ | Science Park 123 (L321) | | Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
On Thu, Mar 31, 2011 at 01:28:57PM +0300, Michael Sioutis wrote:
Well yes, actually I don't want to deal with an SQLException in my code. Having an SQL query (SELECT name FROM tables WHERE name like 'table_I_want_to_drop';) to see if the table is there as Fabian suggested and then move on to dropping it if it exists by checking the results of the query, works for me.
Good. ;-)
I was trying to find out if there is a single SQL query that would do that like for example in Ms SQL, but reading a bit the documentation of MonetDB I couldn't come up with sth.
What does such a Ms SQL query look like? And is that SQL:2003 standard or a proprietary Ms SQL extensions?
Stefan
Mike
On Wed, Mar 30, 2011 at 4:55 PM, Stefan de Konink stefan@konink.de wrote:
Because somepeople have scripts that clean up, and dont want these parts to run outside a transaction?
Stefan
Op 30 mrt 2011 om 15:53 heeft Stefan.Manegold@cwi.nl het volgende geschreven:\
Mike,
may I ask why you want to drop a table that does not exist?
Stefan
On Wed, Mar 30, 2011 at 04:41:15PM +0300, Michael Sioutis wrote:
Hello,
I want to prevent an SQLException from occurring for tables that do not exist in my database. For example: sql>DROP TABLE "locked"; SQLException:sql.catalog:DROP TABLE: no such table 'locked'
It seems (and is documented) that there is no such thing like "IF EXISTS" in MonetDB. Is there a way to circumvent the SQLException?
Mike
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar
MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- | Stefan.Manegold @ CWI.nl | DB Architectures (INS1) | | http://CWI.nl/~manegold/ | Science Park 123 (L321) | | Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
On 31-03-2011 13:05:59 +0200, Stefan.Manegold@cwi.nl wrote:
On Thu, Mar 31, 2011 at 01:28:57PM +0300, Michael Sioutis wrote:
Well yes, actually I don't want to deal with an SQLException in my code. Having an SQL query (SELECT name FROM tables WHERE name like 'table_I_want_to_drop';) to see if the table is there as Fabian suggested and then move on to dropping it if it exists by checking the results of the query, works for me.
Good. ;-)
I was trying to find out if there is a single SQL query that would do that like for example in Ms SQL, but reading a bit the documentation of MonetDB I couldn't come up with sth.
What does such a Ms SQL query look like? And is that SQL:2003 standard or a proprietary Ms SQL extensions?
Extension, like MySQL's "IF EXISTS" clause at the end of the query.
I stumbled upon this on google: IF EXISTS(SELECT 1 FROM sys.objects WHERE OBJECT_ID = OBJECT_ID(N'table_to_drop') AND type = (N'U')) DROP TABLE table_to_drop
I believe it's an extension.
Mike
On Thu, Mar 31, 2011 at 2:05 PM, Stefan.Manegold@cwi.nl wrote:
On Thu, Mar 31, 2011 at 01:28:57PM +0300, Michael Sioutis wrote:
Well yes, actually I don't want to deal with an SQLException in my code. Having an SQL query (SELECT name FROM tables WHERE name like 'table_I_want_to_drop';) to see if the table is there as Fabian suggested and then move on to dropping it if it exists by checking the results of the query, works for me.
Good. ;-)
I was trying to find out if there is a single SQL query that would do
that
like for example in Ms SQL, but reading a bit the documentation of MonetDB I couldn't come up with sth.
What does such a Ms SQL query look like? And is that SQL:2003 standard or a proprietary Ms SQL extensions?
Stefan
Mike
On Wed, Mar 30, 2011 at 4:55 PM, Stefan de Konink stefan@konink.de
wrote:
Because somepeople have scripts that clean up, and dont want these parts to run outside a transaction?
Stefan
Op 30 mrt 2011 om 15:53 heeft Stefan.Manegold@cwi.nl het volgende geschreven:\
Mike,
may I ask why you want to drop a table that does not exist?
Stefan
On Wed, Mar 30, 2011 at 04:41:15PM +0300, Michael Sioutis wrote:
Hello,
I want to prevent an SQLException from occurring for tables that do not exist in my database. For example: sql>DROP TABLE "locked"; SQLException:sql.catalog:DROP TABLE: no such table 'locked'
It seems (and is documented) that there is no such thing like "IF EXISTS" in MonetDB. Is there a way to circumvent the SQLException?
Mike
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar
MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- | Stefan.Manegold @ CWI.nl | DB Architectures (INS1) | | http://CWI.nl/~manegold/ | Science Park 123 (L321) | | Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability
Checker
today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
Enable your software for Intel(R) Active Management Technology to meet
the
growing manageability and security demands of your customers.
Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your
software
be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- | Stefan.Manegold @ CWI.nl | DB Architectures (INS1) | | http://CWI.nl/~manegold/ | Science Park 123 (L321) | | Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
participants (5)
-
Fabian Groffen
-
Michael Sioutis
-
Michael Sioutis
-
Stefan de Konink
-
Stefan.Manegold@cwi.nl