', 'Rich', 'Text in List') latin1_swedish_ci No Text
as you can see campaign_id clearly exists in the table
Is my table corrupt?
Any ideas?
Thank you for your help.
Richard
--
Richard Whitney
phpmy...@gmail.com
http://phpmydev.com
Ofc. 602-288-5340
Ofc. 877-624-6302
Fax. 480-704-4559
You come up
space_id int(10) UNSIGNED No auto_increment
scheme_id int(10) UNSIGNED No 0
campaign_id int(10) UNSIGNED No 0
type enum('Text', 'Banner', 'Rich', 'Text in List') latin1_swedish_ci No Text
as you can see campaign_id clearly exists in the table
Is my table corrupt?
Any ideas?
Thank
Hello,
What is the best method to check if (one or more) row exists (note:
primary key is auto inc and table engine is InnoDB - but what if these
were not true) ?
1) SELECT * FROM table WHERE condition
Check to see if the result set is non-empty.
2) SELECT COUNT(*) AS cnt FROM table WHERE
SELECT EXISTS(
SELECT * FROM table WHERE condition
)
- Perrin
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
At 12:00 AM 11/21/2008, you wrote:
In the last episode (Nov 20), mos said:
At 08:02 PM 11/20/2008, you wrote:
Try drop table if exists Tablex;
Ahhh, I don't necessarily want to drop the table if it already
exists. :) If the table already exists then I'll add new rows to it
(and keep
How can I determine if a temporary table exists? Normally I use something like:
create temporary table Tablex like Table1;
show tables like Tablex;
but the Show Tables never displays any rows for a temporary table even
though the temporary Tablex exists. (All in same thread).
So
Try drop table if exists Tablex;
On Fri, Nov 21, 2008 at 9:53 AM, mos [EMAIL PROTECTED] wrote:
How can I determine if a temporary table exists? Normally I use something
like:
create temporary table Tablex like Table1;
show tables like Tablex;
but the Show Tables never displays any rows
At 08:02 PM 11/20/2008, you wrote:
Try drop table if exists Tablex;
Ahhh, I don't necessarily want to drop the table if it already exists. :)
If the table already exists then I'll add new rows to it (and keep the
existing rows). If the table doesn't exist, then I'll create it.
I suppose
In the last episode (Nov 20), mos said:
At 08:02 PM 11/20/2008, you wrote:
Try drop table if exists Tablex;
Ahhh, I don't necessarily want to drop the table if it already
exists. :) If the table already exists then I'll add new rows to it
(and keep the existing rows). If the table doesn't
-Original Message-
From: Jim Lyons [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 24, 2008 12:00 PM
To: Deniss Hennesy
Cc: mysql
Subject: Re: ERROR 1050 ( ) at line : Table 'columns_priv' already
exists
correction, the command that's failing evidently is the 'create table
columns_priv
All Dear friends
İ am mentioning that 2 different server
one is running on mysql 4.1 (Current) (dumped)
the other is 5.1..xxx (New) (restored)
İ solved my problem in such a way that i droped in my new server mysql and
test databases
mysql show databases;
The command that's failing evidently is the drop table columns_priv which
is why you're getting the error message:
*ERROR 1050 ( ) at line : Table 'columns_priv' already exists*
I assume you're trying to restore the mysql database from a backup and the
script is trying to re-create
( ) at line : Table 'columns_priv' already exists*
I assume you're trying to restore the mysql database from a backup and the
script is trying to re-create the privileges tables. You cannot create a
table that already exists, so you must drop it first. When you installed a
mysql instance
Hi to list
i ve installed new server. while i was restoring my backup to this server.
i took this error and restoring procees is to stop.
*ERROR 1050 ( ) at line : Table 'columns_priv' already exists*
My old server mysql version is mysql-client-4.0.20 is running on old
server
You're restoring the mysql database itself, do you mean to do this? You
probably do if it's a new server but there already exists a mysql database
so, unless your restore program does DROP TABLE before each create, you'll
keep getting this error.
On Fri, Aug 22, 2008 at 10:22 AM, Deniss Hennesy
:
You're restoring the mysql database itself, do you mean to do this? You
probably do if it's a new server but there already exists a mysql database
so, unless your restore program does DROP TABLE before each create, you'll
keep getting this error.
On Fri, Aug 22, 2008 at 10:22 AM, Deniss
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?
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 recipes;
Query OK, 0 rows affected
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 in your example
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
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 SHOW WARNINGS
Can anyone tell me why this isn't working... v5.0
INSERT INTO master_comments (comment_no,comment_text,language_id)
SELECT comment_no,comment_text,language_id from mComments
WHERE NOT EXISTS (SELECT comment_no FROM master_comments);
I thought I had it working once but now it isn't
I think I sorted it out ...
INSERT INTO master_comments (comment_no,comment_text,language_id)
SELECT comment_no,comment_text,language_id from mComments
WHERE NOT EXISTS
(
SELECT comment_no
FROM master_comments
WHERE mComments.comment_no = master_comments.comment_no
);
Hope this helps someone
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
- apparently a bug
has been raised
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
response also sucked.
DROP INDEX
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
be
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 been raised but as far as I know its not fixed yet.
Does anyone know
You may want to check to see if the index exists first.
Just query the table INFORMATION_SCHEMA.STATISTICS:
SELECT COUNT(1) FROM INFORMATION_SCHEMA.STATISTICS
WHERE table_schema = 'given schema'
AND table_name = 'given table name'
AND index_name = 'given index name';
This returns the number
I actually suggested that last night, and thought better of it because
the alter ignore was so much simpler...
On Dec 3, 2007 11:18 AM, Rolando Edwards [EMAIL PROTECTED] wrote:
You may want to check to see if the index exists first.
Just query the table INFORMATION_SCHEMA.STATISTICS:
SELECT
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 General Mailing List
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 `alumni
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
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
Hi
Im contructing a build script and would like to dump my dev db with
mysqldump so I can run a deploy script on the production server with the
update db.
I would like to construct the script so that it updates existing
tables/fields/posts and add new tables/fields/post if they do not exists
PM
To: mysql@lists.mysql.com
Subject: WHERE (NOT) EXISTS problem
Having a very bad time with the subject sorts of queries.
Here is a simple reproduction of the problem for me.
Perhaps I'm blind/stupid while looking at the docs,
or there's a bug...
mysql version 5.0.24-standard
simple schema
@lists.mysql.com
Subject: Re: WHERE (NOT) EXISTS problem
Michael Fischer wrote:
Having a very bad time with the subject sorts of queries.
Here is a simple reproduction of the problem for me.
Perhaps I'm blind/stupid while looking at the docs,
or there's a bug...
mysql version 5.0.24-standard
simple
people WHERE EXISTS
(select * from people_city_map where cid = 1);
+-+
| name|
+-+
| michael |
| daniel |
| glenn |
| susan |
| lisa|
| reggie |
+-+
Huh? Shouldn't that be limited to the people mapped to New York (michael,
daniel)?
Conversely:
mysql
...
mysql SELECT distinct name
FROM people WHERE EXISTS
(select * from people_city_map where cid = 1);
+-+
| name|
+-+
| michael |
| daniel |
| glenn |
| susan |
| lisa|
| reggie |
+-+
Huh? Shouldn't that be limited to the people mapped to New York (michael
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]
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: mysql@lists.mysql.com
Sent: Friday, September 01, 2006 3:28 PM
Subject: Drop Index if Exists
Folks,
Does
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 - Adam
Visolve DB TEAM
Neil Tompkins wrote:
Using this query seems to hang my computer and mySQL server reported the
queries had been LOCKED.
How many records are in each table?
It could take a while, especially if you don't have indexes on the join
fields.
--
MySQL General Mailing List
For list archives:
Hi,
I've two tables. What query do I need to use to get a list of all records from
table A where table B doesn't contain a a mathing record. For example
TableA
ID
Name
TableB
Date
ID
Name
Thanks
Neil
_
Be one of the first
Hi Neil,
what you need is a LEFT JOIN:
SELECT a.*
FROM TableA a
LEFT JOIN TableB b ON a.ID = b.ID (assuming ID is what you relate the
tables on )
WHERE b.ID IS NULL;
should hopefully do what you want.
/Johan
Neil Tompkins skrev:
Hi,
I've two tables. What
Using this query seems to hang my computer and mySQL server reported the
queries had been LOCKED.
Date: Mon, 21 Aug 2006 11:09:35 +0200 From: [EMAIL PROTECTED] To: [EMAIL
PROTECTED] CC: mysql@lists.mysql.com Subject: Re: Return list where no data
exists Hi Neil, what you need is a LEFT
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 10.0.0.2
--- 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 10.0.0.1
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 3**
*So of the 5000 events "count(*) between 2005-12-10
and
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
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(*)
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
if the CREATE DATABASE and CREATE TABLE have a IF NOT EXISTS
functionality, why should the triggers be any different? Maybe this is
just an oversight, maybe the CREATE TRIGGER should have a IF NOT EXISTS
functionality also? or I'm just doing something very wrong.
Maybe someone can point me
Hi,
Sorry if I wasn't very clear with my question. I was hoping to obtain
the functionality such that I could do something similar to:
CREATE TRIGGER IF NOT EXISTS
Because I usually get a trigger already exists in my script. I might be
missing something.
The script basically does
, you could try it yourself and see that it fails.
-Sheeri
On 4/7/06, Adrian Co [EMAIL PROTECTED] wrote:
Hi,
Sorry if I wasn't very clear with my question. I was hoping to obtain
the functionality such that I could do something similar to:
CREATE TRIGGER IF NOT EXISTS
Because I usually
and CREATE TABLE have a IF NOT EXISTS
functionality, why should the triggers be any different? Maybe this is
just an oversight, maybe the CREATE TRIGGER should have a IF NOT EXISTS
functionality also? or I'm just doing something very wrong.
Maybe someone can point me in the right direction
Hi,
Whats the simplest way to determine if a trigger already exists?
i.e. For tables you have: CREATE TABLE IF NOT EXISTS ...
Is there a way to do
CREATE TRIGGER IF NOT EXISTS
I'm using MySQL 5.0 btw.
Thanks!
Regards,
Adrian
--
MySQL General Mailing List
For list archives: http
: Determining if a trigger exists
Hi,
Whats the simplest way to determine if a trigger already exists?
i.e. For tables you have: CREATE TABLE IF NOT EXISTS ...
Is there a way to do
CREATE TRIGGER IF NOT EXISTS
I'm using MySQL 5.0 btw.
Thanks!
Regards,
Adrian
--
MySQL General Mailing List
From: Rithish Saralaya [EMAIL PROTECTED]
Subject: RE: error 1016 : cant open ibd file even though it exists
Hello Keith.
The power outage was known before-hand, and the server was
shutdown before the outage happened. The server was
brought up once the power returned. So no UPs
Rithish,
- Original Message -
From: Rithish Saralaya [EMAIL PROTECTED]
Newsgroups: mailing.database.myodbc
Sent: Monday, February 27, 2006 7:06 AM
Subject: RE: error 1016 : cant open ibd file even though it exists
Heikki.
I found the ibdata1 and ib_log files located in only '/var
]
Sent: Saturday, February 25, 2006 8:13 PM
To: mysql@lists.mysql.com
Subject: RE: error 1016 : cant open ibd file even though it exists
I do not use Innodb tables at the moment, so all this is
pure speculation.
Is/was the server connected to a UPS when the power failure
happened?
If so, did
it has to any db/table?
Regards,
Rithish.
-Original Message-
From: Heikki Tuuri [mailto:[EMAIL PROTECTED]
Sent: Monday, February 27, 2006 1:54 PM
To: mysql@lists.mysql.com
Subject: Re: error 1016 : cant open ibd file even though it exists
Rithish,
- Original Message -
From
: Re: error 1016 : cant open ibd file even though it exists
Rithish,
ok, then the most probable explanation is that someone had edited my.cnf
earlier, when mysqld was running. When mysqld was restarted, it read the new
my.cnf, and got confused.
Please ask your sysadmins to scan the file system
, February 24, 2006 3:55 PM
To: mysql@lists.mysql.com
Subject: Re: error 1016 : cant open ibd file even though it exists
Rithish,
from the .err log we see that mysqld was shut down for 12 hours on Feb 19th.
What did the sysadmins do during that time?
There are two plausible explanations:
1
it exists
Rithish,
from the .err log we see that mysqld was shut down for 12 hours on Feb 19th.
What did the sysadmins do during that time?
There are two plausible explanations:
1) they edited datadir in my.cnf to point to a different location (
/var/lib/mysql),
or
2) they removed ibdata1
PROTECTED]
Sent: Saturday, February 25, 2006 3:32 PM
To: Rithish Saralaya
Cc: mysql@lists.mysql.com
Subject: Re: error 1016 : cant open ibd file even though it exists
Hi Rithish,
After reading Heikkis points, I am inclined to agree. Did your sysadmins
change a filesystem during
Saralaya [EMAIL PROTECTED]
Newsgroups: mailing.database.myodbc
Sent: Saturday, February 25, 2006 12:14 PM
Subject: RE: error 1016 : cant open ibd file even though it exists
--=_NextPart_000_001D_01C63A22.BB0C91A0
Content-Type: text/plain;
charset=Windows-1252
Content-Transfer-Encoding: 7bit
though it exists
Hello David.
There was supposed to be a power outage in our office that day. So the
server was shut down. Finally when the power was back, the machine was
plugged on. That's all. No file system change. Nothing.
Regards,
Rithish.
--
MySQL General Mailing List
For list
/order.php
- Original Message -
From: Rithish Saralaya [EMAIL PROTECTED]
Newsgroups: mailing.database.myodbc
Sent: Friday, February 24, 2006 6:55 AM
Subject: RE: error 1016 : cant open ibd file even though it exists
Hello.
The tables were working perfectly fine a week back
-
From: Rithish Saralaya [mailto:[EMAIL PROTECTED]
Sent: Thursday, 23 February 2006 5:02 PM
To: Logan, David (SST - Adelaide); MySQL general mailing list
Subject: RE: error 1016 : cant open ibd file even though it exists
Hello David. Thanks for the prompt response.
The permissions were the first
- Adelaide); MySQL general mailing list
Subject: RE: error 1016 : cant open ibd file even though it exists
Hello David. Thanks for the prompt response.
The permissions were the first thing that I checked when I got the
error. In
fact, I even tried giving 777 permissions on the .ibd files. No results
-
From: Ady Wicaksono [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 23, 2006 5:50 PM
To: Logan, David (SST - Adelaide)
Cc: Rithish Saralaya; MySQL general mailing list
Subject: Re: error 1016 : cant open ibd file even though it exists
Try to help
Please give us the ls -l result of this file, also
1016 : cant open ibd file even though it exists
From: Rithish Saralaya rithish.saralaya () tallysolutions ! com
Date: 2006-02-22 11:27:44
Message-ID: ANEAKJJGBMNHIAEBLIAIMEPCECAA.rithish.saralaya ()
tallysolutions ! com
[Download message RAW]
Hello.
I get the following error when I try
' (errno: 1)
However, I have noticed that both the .frm and the .ibd file exists for the
table TBL_FORUM_MSG_BODY. Then why the error? I looked into the error log
and it is as follows
060222 15:14:09 InnoDB error:
Cannot find table test/TBL_FORUM_MSG_BODY from the internal data dictionary
the mysql is located. That's
proper.
-Original Message-
From: sheeri kritzer [mailto:[EMAIL PROTECTED]
Sent: Friday, February 24, 2006 3:22 AM
To: Rithish Saralaya
Cc: MySQL general mailing list
Subject: Re: error 1016 : cant open ibd file even though it exists
What are the permissions
@lists.mysql.com
Subject: Re: error 1016 : cant open ibd file even though it exists
Rithish,
the table definition does not exist in the ibdata file. You have the
.frm file and the .ibd file, but that does not help if the table
definition is not stored in the ibdata file.
How did you end up
:
To: MySQL general mailing list mysql@lists.mysql.com
From: Rithish Saralaya [EMAIL PROTECTED]
Subject: RE: error 1016 : cant open ibd file even though it exists
Hello.
The tables were working perfectly fine a week back. The database was created
from a sql file generated through
that both the .frm and the .ibd file exists for the
table TBL_FORUM_MSG_BODY. Then why the error? I looked into the error log
and it is as follows
060222 15:14:09 InnoDB error:
Cannot find table test/TBL_FORUM_MSG_BODY from the internal data dictionary
of InnoDB though the .frm file for the table exists
[mailto:[EMAIL PROTECTED]
Sent: Thursday, 23 February 2006 3:43 PM
To: MySQL general mailing list
Subject: error 1016 : cant open ibd file even though it exists
Hello.
I get the following error when I try to query a table in a particular
database (test). The error is generated for all tables within
that both the .frm and the .ibd file exists for the
table TBL_FORUM_MSG_BODY. Then why the error? I looked into the error log
and it is as follows
060222 15:14:09 InnoDB error:
Cannot find table test/TBL_FORUM_MSG_BODY from the internal data dictionary
of InnoDB though the .frm file for the table exists
PROTECTED]
Sent: Thursday, February 23, 2006 10:42 AM
To: Rithish Saralaya; MySQL general mailing list
Subject: RE: error 1016 : cant open ibd file even though it exists
Hi Rithish,
Please check your ownership/permissions
hambone ~ $ perror 1
OS error code 1: Not owner
hambone ~ $
Regards
Hi All,
Having a bit of mysqldump trouble again. I've looked over the
documentation (again) and can't seem to find the flag to make
'mysqldump' out put CREATE TABLE IF NOT EXISTS. Any ideas?
Regards,
Michael
--
MySQL General Mailing List
For list archives: http://lists.mysql.com
DROP TABLE IF NOT EXISTS?
On 1/16/06, Michael Williams [EMAIL PROTECTED] wrote:
Hi All,
Having a bit of mysqldump trouble again. I've looked over the
documentation (again) and can't seem to find the flag to make
'mysqldump' out put CREATE TABLE IF NOT EXISTS. Any ideas?
Regards
I appreciate the suggestion, but I'm not looking to drop anything. I
only want it as a safety net in the event that the table doesn't
already exist. I'm doing syncing of sorts, and I want the CREATE
TABLE IF NOT EXISTS so as not to throw errors in the event that the
table already exists
Hi all,
I've got a problem that I don't understand and that is driving me mad.
I have a table 'tab_p' with this structure:
nametype
---
p_idmediumint(8) AUTOINCREMENT NOT NULL PRIMARY KEY
d_idsmallint(5) NOT NULL
namevarchar(50) NOT NULL
Wenca wrote:
SELECT * FROM tab_p WHERE d_id = 20602 AND name LIKE 'Machico'
- no results
Try it with ...AND `name` LIKE '%Machico%';
I have encountered it once when there were non printable characters in
front of or after the text itself. Very frustrating!
You can see what extra characters
had a similar situation in the past.
Hope this helps,
Paul
-Original Message-
From: Wenca [mailto:[EMAIL PROTECTED]
Sent: 27 October 2005 10:56
To: mysql@lists.mysql.com
Subject: Record exists but not found - grrr
Hi all,
I've got a problem that I don't understand
I am converting some code from MSSQL to MySQL. In one place I need to
have a conditional query depending on if a table exists or not. There
are different versions of this application and the table only exists in
some of them. Here is how it was done in MSSQL:
IF OBJECT_ID('cfgbiz') IS NOT NULL
Ryan,
I am converting some code from MSSQL to MySQL. In one place I need to
have a conditional query depending on if a table exists or not. There
are different versions of this application and the table only exists in
some of them. Here is how it was done in MSSQL:
If 'SHOW COLUMNS FROM
If 'SHOW COLUMNS FROM tablename' returns error 1146 (42S02), the
table doesn't exist.
This causes my application (ColdFusion) to throw an exception.
If I have to, I could resort to doing another query in my application
(SHOW TABLES) and seeing if my table was returned in that list. But I
was
Ryan Stille wrote:
If I have to, I could resort to doing another query in my application
(SHOW TABLES) and seeing if my table was returned in that list. But I
was hoping for a more elegant way to do it, within the single query.
Maybe you could use
SHOW TABLES LIKE 'your_table';
--
Keith
On Thursday 06 October 2005 10:57 am, Ryan Stille wrote:
I am converting some code from MSSQL to MySQL. In one place I need to
have a conditional query depending on if a table exists or not. There
are different versions of this application and the table only exists in
some of them. Here
Maybe you could use
SHOW TABLES LIKE 'your_table';
That's a great idea, I just tried it in several ways, like:
IF EXISTS (SHOW TABLES LIKE 'cfgbiz') THEN
SELECT siacnotifyto FROM cfgbiz
ELSE
SELECT '' as siacnotifyto
END IF;
-and-
select IF((SHOW TABLES LIKE 'cfgbiz'),notifyto
Hello.
You can parse the output of 'SHOW CREATE TABLE' or 'SHOW COLUMNS'. See:
http://dev.mysql.com/doc/mysql/en/show-columns.html
http://dev.mysql.com/doc/mysql/en/show-create-table.html
Claire Lee wrote:
I want to check if a column exists in a table before I
do an alter
Hello Guys,
I'm using the 5.0.12 version of MySQL PRO on AMD64 3000+ with 1 GB of
ram and using the InnoDB Tables..
Here is my table:
CREATE TABLE `svcs_filecontrol` (
`fc_id` int(10) unsigned NOT NULL auto_increment,
`fc_us_id_lockby` int(10) unsigned default NULL,
`fc_lbl_id` int(10)
I want to check if a column exists in a table before I
do an alter table to add it. How do I do this in
mysql? Thanks.
Claire
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
MySQL
Dyego Souza Dantas Leal wrote:
Hello Guys,
I'm using the 5.0.12 version of MySQL PRO on AMD64 3000+ with 1 GB of
ram and using the InnoDB Tables..
snip
Here is the Select:
mysql select f1.fc_package from svcs_filecontrol f1 where f1.fc_id in (
- *select max(f2.fc_id) from
Claire,
I want to check if a column exists in a table before I
do an alter table to add it. How do I do this in
mysql? Thanks.
If you are using MySQL 5.0, query information_schema.columns
(http://dev.mysql.com/doc/mysql/en/columns-table.html) for the table and
column. Otherwise use SHOW
Hi,
2005/9/26, Peter Brawley [EMAIL PROTECTED]:
Claire,
I want to check if a column exists in a table before I
do an alter table to add it. How do I do this in
mysql? Thanks.
other solution, do your query in all case and check for the return
error (if any).
mysql alter table board add
Hi,
Now as expected it's an dependent subquery and makes use of the index on
document_id. BUT: If we change the SELECT id in the subquery to
SELECT document_id or SELECT 1, we get:
*** 1. row ***
[...]
*** 2. row
Hi all,
the manual says:
If a subquery returns any rows at all, then EXISTS subquery is TRUE,
and NOT EXISTS subquery is FALSE. ... Traditionally, an EXISTS subquery
starts with SELECT *, but it could begin with SELECT 5 or SELECT column1
or anything at all. MySQL ignores the SELECT list
1 - 100 of 324 matches
Mail list logo