RE: DROP TABLE IF EXISTS - doesnt??

2008-08-15 Thread Fish Kungfu
>Maybe what I am seeing in the Query Browser area is in fact a Warning >message and not an error!! Ahhh...yes maybe that's it. Just fyi, here is the detail of the warning: mysql> drop table if exists recipes; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql&

RE: DROP TABLE IF EXISTS - doesnt??

2008-08-15 Thread Martin Gainty
I am certain the SQLBrowser program authors want to hear about this error It may be due to the fact that MYSQL procedures need to have a different delimiter (//) instead of ; e.g. use DBNAME; DROP PROCEDURE IF EXISTS TABLE_NAME; delimiter //; Anyone? Martin

RE: DROP TABLE IF EXISTS - doesnt??

2008-08-15 Thread roger.maynard
I am getting this problem when I am calling this from within a stored procedure and from the command line area but from MySQLQueryBrowser Windows package. I have tried the DROP TABLE IF EXISTS from the mysql "DOS-type" command line and it doesn't error - I do notice that (also

Re: DROP TABLE IF EXISTS - doesnt??

2008-08-15 Thread Fish Kungfu
can turn off this feature to get a quicker startup with -A Database changed mysql> show tables; +---+ | Tables_in_lsldatabase | +---+ | lslstore | +---+ 1 row in set (0.00 sec) mysql> drop table if exists recipe

DROP TABLE IF EXISTS - doesnt??

2008-08-15 Thread roger.maynard
I am finding that DROP TABLE IF EXISTS mytable; Works fine if the table exists - but if it doesn't exist I get an error? Surely it should not error and just not try to drop the table. Is it me?

Re: how to "drop index if exists"

2007-12-05 Thread Baron Schwartz
On Dec 5, 2007 7:03 AM, Adam Lipscombe <[EMAIL PROTECTED]> wrote: > Sorry I got carried away in my former response. > > When I tried this, > ALTER IGNORE TABLE tbl_name DROP INDEX seems to fail if the index does not > exist. Right. ALTER IGNORE means that rows that violate unique indexes won't b

Re: how to "drop index if exists"

2007-12-05 Thread Adam Lipscombe
MySQL? Googling shows that the "drop index" does not support an "if exists" qualifier - apparently a bug has been raised but as far as I know its not fixed yet. Does anyone know of a work-around? TIA - Adam Sent my first response late at night and not the community... And the r

Re: how to "drop index if exists"

2007-12-05 Thread Adam Lipscombe
Fantastic, thanks very much! Adam Rob Wultsch wrote: On Nov 29, 2007 4:34 AM, Adam Lipscombe <[EMAIL PROTECTED]> wrote: Folks How can one conditionally drop an index in MySQL? Googling shows that the "drop index" does not support an "if exists" qualifier -

Re: how to "drop index if exists"

2007-12-03 Thread Rob Wultsch
oes not exist. > > If this query returns a positive number, then call > ALTER TABLE DROP INDEX ; > > You may want to write this stored procedure to do this. > Here is the Code (change the 'util' schema to the schema you want) : > > DELIMITER $$ > > DRO

RE: how to "drop index if exists"

2007-12-03 Thread Rolando Edwards
index contains. If this query returns zero(0), then the index does not exist. If this query returns a positive number, then call ALTER TABLE DROP INDEX ; You may want to write this stored procedure to do this. Here is the Code (change the 'util' schema to the schema you want) : DELI

Re: how to "drop index if exists"

2007-12-03 Thread Rob Wultsch
On Nov 29, 2007 4:34 AM, Adam Lipscombe <[EMAIL PROTECTED]> wrote: > Folks > > > How can one conditionally drop an index in MySQL? > > Googling shows that the "drop index" does not support an "if exists" > qualifier - apparently a bug > has

how to "drop index if exists"

2007-11-29 Thread Adam Lipscombe
Folks How can one conditionally drop an index in MySQL? Googling shows that the "drop index" does not support an "if exists" qualifier - apparently a bug has been raised but as far as I know its not fixed yet. Does anyone know of a work-around? TIA - Adam -- MySQL

Re: DROP TRIGGER IF EXISTS throws error??

2007-10-05 Thread Jesse
Are you sure that's the exact query and error message? The query has a backtick; the error message has none, which is unusual for a purely syntactic error. It makes me suspicious that the error is coming from something else: maybe a subtly mangled file. I found the problem. When I ran the M

Re: DROP TRIGGER IF EXISTS throws error??

2007-10-05 Thread Baron Schwartz
Hi, Jesse wrote: I'm attempting to restore a couple of backups, and part way through, I get the error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF EXISTS alumni' at line 1 Query is:

DROP TRIGGER IF EXISTS throws error??

2007-10-05 Thread Jesse
I'm attempting to restore a couple of backups, and part way through, I get the error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF EXISTS alumni' at line 1 Query is: DROP TRIGGER IF

Re: Drop Index if Exists

2006-09-01 Thread Adam Lipscombe
Thanks What I am getting at is: does the "IF EXISTS" qualifier work in this context? I have an index that is present in some DB's but not in others. I want to run a generic script to upgrade them all. I don't want the script to stop if the index is not present. Thanks

Re: Drop Index if Exists

2006-09-01 Thread Visolve DB TEAM
Hello Adam,This is the exact syntax to drop the index.DROP INDEX index_name ON tbl_nameThanksVisolve DB Team . - Original Message - From: "Adam Lipscombe" <[EMAIL PROTECTED]> Cc: Sent: Friday, September 01, 2006 3:28 PM Subject: Drop Index if Exists Folks, Does this

Drop Index if Exists

2006-09-01 Thread Adam Lipscombe
Folks, Does this work in MYSQL 5? I tried "DROP INDEX [NAME] IF EXISTS;" and got an error "check your syntax". Thanks - Adam -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: If exists query.

2006-04-24 Thread Peter Brawley
Paul, >> > > I am doing queries that produce a table that looks something like this: >> > > >> > > Count   | IP Address    | First Seen    | Last Seen | Days >> > > 5000  10.0.0.1   2005-12-10    2006-04-15  50* >> > > 6500  10.0.0.2   2006-04-01    2006-04-06  

Re: If exists query.

2006-04-24 Thread Shawn Green
--- Paul Halliday <[EMAIL PROTECTED]> wrote: > On 4/23/06, John Hicks <[EMAIL PROTECTED]> wrote: > > Paul Halliday wrote: > > > > I am doing queries that produce a table that looks something like > this: > > > > > > Count | IP Address| First Seen| Last Seen | Days > > > 5000

Re: If exists query.

2006-04-24 Thread Paul Halliday
On 4/23/06, John Hicks <[EMAIL PROTECTED]> wrote: > Paul Halliday wrote: > > I am doing queries that produce a table that looks something like this: > > > > Count | IP Address| First Seen| Last Seen | Days > > 5000 10.0.0.1 2005-12-102006-04-15 50* > > 6500

Re: If exists query.

2006-04-23 Thread Paul Halliday
I am doing queries that produce a table that looks something like this: Count | IP Address| First Seen| Last Seen | Days 5000 10.0.0.1 2005-12-102006-04-15 50* 6500 10.0.0.2 2006-04-012006-04-06 3** *So of the 5000 events "count(*) bet

Re: If exists query.

2006-04-23 Thread John Hicks
Paul Halliday wrote: I am trying to formulate a query that will increment if a condition is true. For example, if I do a select (just let me know if there was data on this day, if so increment count by 1 and check the next day) where timestamp between jan and feb. Could you be a bit more speci

If exists query.

2006-04-21 Thread Paul Halliday
I am trying to formulate a query that will increment if a condition is true. For example, if I do a select (just let me know if there was data on this day, if so increment count by 1 and check the next day) where timestamp between jan and feb. Thanks. -- MySQL General Mailing List For list archi

Re: if exists

2004-05-05 Thread Michael Stassen
I think this is half the answer (though you've implied the other half). First, you prevent mysql from accepting duplicate rows by defining a PRIMARY KEY or UNIQUE INDEX on whatever column or columns determine uniqueness. See for the details.

Re: if exists

2004-05-05 Thread Paul DuBois
At 12:12 +0200 5/5/04, Gerhard Gaupp wrote: Hello I'm looking for something like if not exists( select 1 from PERSON where NAME = 'Test' ) then insert into PERSON ( NAME ) values ( 'Test'); end if; I did it with Sybase Database. I need to get Data from Excel and have to be shure that there is

RE: if exists

2004-05-05 Thread emierzwa
Silently ignore duplicate index inserts... insert IGNORE into PERSON ( NAME ) values ( 'Test') Ed -Original Message- From: Gerhard Gaupp [mailto:[EMAIL PROTECTED] Hello I'm looking for something like if not exists( select 1 from PERSON where NAME = 'Test' ) then insert into PERSON (

if exists

2004-05-05 Thread Gerhard Gaupp
Hello I'm looking for something like if not exists( select 1 from PERSON where NAME = 'Test' ) then insert into PERSON ( NAME ) values ( 'Test'); end if; I did it with Sybase Database. I need to get Data from Excel and have to be shure that there is no data more than once in the table. So I

Re: If Exists update else insert

2004-02-18 Thread Victoria Reznichenko
"Juan E Suris" <[EMAIL PROTECTED]> wrote: > I need to do something similar to replace, but can't figure out how to do it. > > Here's my table: > user varchar(15) PRI > cnt int(11) > > I want to increment cnt for user if it exists, else insert a row with cnt=1. I tried > the following, but mysql

If Exists update else insert

2004-02-18 Thread Juan E Suris
I need to do something similar to replace, but can't figure out how to do it. Here's my table: user varchar(15) PRI cnt int(11) I want to increment cnt for user if it exists, else insert a row with cnt=1. I tried the following, but mysql complains that I can't use the same table in the update

Re: query: if exists UPDATE else INSERT?

2003-07-14 Thread Sergei Golubchik
Hi! On Jul 13, Alexander Newald wrote: > Hello, > > I have a table with id (char(8)) and value (int(8)) > > To make my problem clear: > > There is no set with id = "20030713" > insert into table values ("20030713","10"); > > The next set is ("20030713","20") but as a set with 20030713 is > alr

Re: query: if exists UPDATE else INSERT?

2003-07-13 Thread Paul Chvostek
On Sun, Jul 13, 2003 at 09:52:10AM -0400, Paul Chvostek wrote: ... > $q = "UPDATE table SET value=value+$value WHERE id='$id';"; > $q .= "INSERT INTO table (id,value) VALUES ('$id',$value)"; > @mysql_query($q); Woop, I forgot this was the mysql list, not a php- list. ;-) The basic thing

Re: query: if exists UPDATE else INSERT?

2003-07-13 Thread Paul Chvostek
On Sun, Jul 13, 2003 at 11:50:40AM +0200, Alexander Newald wrote: > > I'm looking for a solution to write a sql query that inserts a set of data if the > data id is not present and otherwise update the set. We covered some of this in a thread named "Bulk loading data" that started on July 8th.

Re: query: if exists UPDATE else INSERT?

2003-07-13 Thread Veysel Harun Sahin
Try this: set @w = 0; select @w := value from table where id = "20030713"; delete from table where id = "20030713"; insert into table values ("20030713", @w + 20); [EMAIL PROTECTED] wrote: Hello, I'm looking for a solution to write a sql query that inserts a set of data if the data id is not

query: if exists UPDATE else INSERT?

2003-07-13 Thread Alexander Newald
Hello, I'm looking for a solution to write a sql query that inserts a set of data if the data id is not present and otherwise update the set. I have a table with id (char(8)) and value (int(8)) To make my problem clear: There is no set with id = "20030713" insert into table values ("20030713",

Re: SV: If exists UPDATE else INSERT

2001-01-26 Thread Gerald L. Clark
ert it if you get an error? > > -Opprinnelig melding- > Fra: Artem Koutchine [mailto:[EMAIL PROTECTED]] > Sendt: 26. januar 2001 19:02 > Til: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Emne: Re: If exists UPDATE else INSERT > > I've seen something about this in t

SV: If exists UPDATE else INSERT

2001-01-26 Thread Pål Wester
Why not do an update regardless if the record exist or not, then insert it if you get an error? -Opprinnelig melding- Fra: Artem Koutchine [mailto:[EMAIL PROTECTED]] Sendt: 26. januar 2001 19:02 Til: [EMAIL PROTECTED]; [EMAIL PROTECTED] Emne: Re: If exists UPDATE else INSERT I've

Re: If exists UPDATE else INSERT

2001-01-26 Thread Artem Koutchine
CTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 26, 2001 7:34 PM Subject: If exists UPDATE else INSERT > I'm have a lot of queries where i have to check if a record exists > and if it does, increment a counter in it (most of the time). If it doesn't > exist I insert

If exists UPDATE else INSERT

2001-01-26 Thread Jan Willamowius
I'm have a lot of queries where i have to check if a record exists and if it does, increment a counter in it (most of the time). If it doesn't exist I insert a new record with counter=1 (this case is rare). Right now I do a select form Perl and then do one or the other. To speed things up I could