Re: Insert query problem

2005-11-30 Thread Brent Baisley
You can use the back quote(`) to escape the field name. It's the ~  
key on the keyboard.

tickets(`from`,`department`,...

If you type SHOW CREATE TABLE tickets, you'll see mysql escapes all  
the field names to avoid reserve word conflicts.


On Nov 29, 2005, at 2:14 PM, Rhino wrote:



- Original Message - From: "Jeff" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, November 29, 2005 11:42 AM
Subject: Insert query problem




All,

I can't get this query to run, it keeps compaining that there is a
problem:

The Query:

insert into
tickets 
(id,from,department,subject,body,lastaction,lastpost,priority,sta

tus,created,fromname,lastpostname,attach,ct,uniq,notify,replyto)
values(null,'jmckeon','1','test','test
test',unix_timestamp(now()),'"[EMAIL PROTECTED]"
<[EMAIL PROTECTED]>','Medium','Open',unix_timestamp(now()),'Jeff
McKeon','Jeff McKeon','','','ks5hslajdfasd','1','[EMAIL PROTECTED]')

The error:

You have an error in your SQL syntax near
'from,department,subject,body,lastaction,lastpost,priority,status,cre 
ate

d,fromnam' at line 1

I suspect it doesn't like the fact that I have a field named  
"from" but
I KNOW it's possible to write to this table and that field, I just  
can't
figure out the correct syntax to get it to accept the fieldname  
"from".



One of my least favourite aspects of MySQL is the vague error  
messages, like the one you quote in your post. I keep hoping that  
they will make them much clearer but it doesn't seem to have  
happened yet


In any case, you may well be right that MySQL doesn't like you  
having a column named 'from'. Most dialects of SQL tolerate that  
kind of thing but usually require escape characters of some kind  
around words like 'from', which are keywords, when they are used  
outside of their normal purpose. I've never had the desire to call  
a column 'from' so I've never learned the escape character  
technique for MySQL so I would suggest the following possibilities:


- change your column name so that _isn't_ a keyword. That would be  
my first choice if it was my database.
- search the MySQL manual for 'escape character' and/or 'keyword';  
with a bit of luck, it is documented there somewhere
- search the MySQL mailing list archives. I'm virtually positive  
I've seen the matter come up in the list but I just don't remember  
the escape syntax at the moment.


If you escape the column named 'from' and the query still doesn't  
work, please repost so that we can investigate other possibilities.


Rhino


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.10/186 - Release Date:  
29/11/2005



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql? 
[EMAIL PROTECTED]






--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Insert query problem

2005-11-29 Thread Rhino


- Original Message - 
From: "Jeff" <[EMAIL PROTECTED]>

To: 
Sent: Tuesday, November 29, 2005 11:42 AM
Subject: Insert query problem



All,

I can't get this query to run, it keeps compaining that there is a
problem:

The Query:

insert into
tickets(id,from,department,subject,body,lastaction,lastpost,priority,sta
tus,created,fromname,lastpostname,attach,ct,uniq,notify,replyto)
values(null,'jmckeon','1','test','test
test',unix_timestamp(now()),'"[EMAIL PROTECTED]"
<[EMAIL PROTECTED]>','Medium','Open',unix_timestamp(now()),'Jeff
McKeon','Jeff McKeon','','','ks5hslajdfasd','1','[EMAIL PROTECTED]')

The error:

You have an error in your SQL syntax near
'from,department,subject,body,lastaction,lastpost,priority,status,create
d,fromnam' at line 1

I suspect it doesn't like the fact that I have a field named "from" but
I KNOW it's possible to write to this table and that field, I just can't
figure out the correct syntax to get it to accept the fieldname "from".

One of my least favourite aspects of MySQL is the vague error messages, like 
the one you quote in your post. I keep hoping that they will make them much 
clearer but it doesn't seem to have happened yet


In any case, you may well be right that MySQL doesn't like you having a 
column named 'from'. Most dialects of SQL tolerate that kind of thing but 
usually require escape characters of some kind around words like 'from', 
which are keywords, when they are used outside of their normal purpose. I've 
never had the desire to call a column 'from' so I've never learned the 
escape character technique for MySQL so I would suggest the following 
possibilities:


- change your column name so that _isn't_ a keyword. That would be my first 
choice if it was my database.
- search the MySQL manual for 'escape character' and/or 'keyword'; with a 
bit of luck, it is documented there somewhere
- search the MySQL mailing list archives. I'm virtually positive I've seen 
the matter come up in the list but I just don't remember the escape syntax 
at the moment.


If you escape the column named 'from' and the query still doesn't work, 
please repost so that we can investigate other possibilities.


Rhino 




--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.10/186 - Release Date: 29/11/2005


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Insert query problem

2005-11-29 Thread mel list_php


You can use backticks ( ` ) to escape the names:
INSERT INTO `tickets` ( `id` , `from` , `departement` .

hth,
melanie


From: "Jeff" <[EMAIL PROTECTED]>
To: 
Subject: Insert query problem
Date: Tue, 29 Nov 2005 11:42:34 -0500

All,

I can't get this query to run, it keeps compaining that there is a
problem:

The Query:

insert into
tickets(id,from,department,subject,body,lastaction,lastpost,priority,sta
tus,created,fromname,lastpostname,attach,ct,uniq,notify,replyto)
values(null,'jmckeon','1','test','test
test',unix_timestamp(now()),'"[EMAIL PROTECTED]"
<[EMAIL PROTECTED]>','Medium','Open',unix_timestamp(now()),'Jeff
McKeon','Jeff McKeon','','','ks5hslajdfasd','1','[EMAIL PROTECTED]')

The error:

You have an error in your SQL syntax near
'from,department,subject,body,lastaction,lastpost,priority,status,create
d,fromnam' at line 1

I suspect it doesn't like the fact that I have a field named "from" but
I KNOW it's possible to write to this table and that field, I just can't
figure out the correct syntax to get it to accept the fieldname "from".

Thanks,

Jeff



_
MSN Messenger 7.5 is now out. Download it for FREE here. 
http://messenger.msn.co.uk



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Insert query problem

2005-11-29 Thread Easyhorpak.com Easyhorpak.com


Many Many wrong SQL syntax error check your symbol (') becareful it 'very 
important .

You can do that.

Cheer!!



From: "Jeff" <[EMAIL PROTECTED]>
To: 
Subject: Insert query problem
Date: Tue, 29 Nov 2005 11:42:34 -0500

All,

I can't get this query to run, it keeps compaining that there is a
problem:

The Query:

insert into
tickets(id,from,department,subject,body,lastaction,lastpost,priority,sta
tus,created,fromname,lastpostname,attach,ct,uniq,notify,replyto)
values(null,'jmckeon','1','test','test
test',unix_timestamp(now()),'"[EMAIL PROTECTED]"
<[EMAIL PROTECTED]>','Medium','Open',unix_timestamp(now()),'Jeff
McKeon','Jeff McKeon','','','ks5hslajdfasd','1','[EMAIL PROTECTED]')

The error:

You have an error in your SQL syntax near
'from,department,subject,body,lastaction,lastpost,priority,status,create
d,fromnam' at line 1

I suspect it doesn't like the fact that I have a field named "from" but
I KNOW it's possible to write to this table and that field, I just can't
figure out the correct syntax to get it to accept the fieldname "from".

Thanks,

Jeff



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]




_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Insert query problem

2005-11-29 Thread Kristen G. Thorson

Jeff wrote:


tickets(id,from,department,subject,body,lastaction,lastpost,priority,sta
tus,created,fromname,lastpostname,attach,ct,uniq,notify,replyto)
values(null,'jmckeon','1','test','test
test',unix_timestamp(now()),'"[EMAIL PROTECTED]"
<[EMAIL PROTECTED]>','Medium','Open',unix_timestamp(now()),'Jeff
McKeon','Jeff McKeon','','','ks5hslajdfasd','1','[EMAIL PROTECTED]')

 



Use `from`

(those are backticks)  See:

http://dev.mysql.com/doc/refman/5.0/en/legal-names.html


kgt


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Insert query problem [solved]

2005-11-29 Thread Jeff
Nevermind, found that usig `from` works.

Jeff

> -Original Message-
> From: Jeff [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, November 29, 2005 11:43
> To: mysql@lists.mysql.com
> Subject: Insert query problem
> 
> 
> All,
> 
> I can't get this query to run, it keeps compaining that there is a
> problem:
> 
> The Query:
> 
> insert into 
> tickets(id,from,department,subject,body,lastaction,lastpost,pr
> iority,sta
> tus,created,fromname,lastpostname,attach,ct,uniq,notify,replyto)
> values(null,'jmckeon','1','test','test
> test',unix_timestamp(now()),'"[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]>','Medium','Open',unix_timestamp(now()),'Jeff
> McKeon','Jeff McKeon','','','ks5hslajdfasd','1','[EMAIL PROTECTED]')
> 
> The error: 
> 
> You have an error in your SQL syntax near 
> 'from,department,subject,body,lastaction,lastpost,priority,sta
> tus,create
> d,fromnam' at line 1
> 
> I suspect it doesn't like the fact that I have a field named 
> "from" but I KNOW it's possible to write to this table and 
> that field, I just can't figure out the correct syntax to get 
> it to accept the fieldname "from".
> 
> Thanks,
> 
> Jeff
> 
> 
> 
> -- 
> 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?> [EMAIL PROTECTED]
> 
> 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Insert query problem

2005-11-29 Thread SGreen
"Jeff" <[EMAIL PROTECTED]> wrote on 11/29/2005 11:42:34 AM:

> All,
> 
> I can't get this query to run, it keeps compaining that there is a
> problem:
> 
> The Query:
> 
> insert into
> tickets(id,from,department,subject,body,lastaction,lastpost,priority,sta
> tus,created,fromname,lastpostname,attach,ct,uniq,notify,replyto)
> values(null,'jmckeon','1','test','test
> test',unix_timestamp(now()),'"[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]>','Medium','Open',unix_timestamp(now()),'Jeff
> McKeon','Jeff McKeon','','','ks5hslajdfasd','1','[EMAIL PROTECTED]')
> 
> The error: 
> 
> You have an error in your SQL syntax near
> 'from,department,subject,body,lastaction,lastpost,priority,status,create
> d,fromnam' at line 1
> 
> I suspect it doesn't like the fact that I have a field named "from" but
> I KNOW it's possible to write to this table and that field, I just can't
> figure out the correct syntax to get it to accept the fieldname "from".
> 
> Thanks,
> 
> Jeff
> 
> 

You have to use backticks: `from`
http://dev.mysql.com/doc/refman/4.1/en/legal-names.html

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine



Insert query problem

2005-11-29 Thread Jeff
All,

I can't get this query to run, it keeps compaining that there is a
problem:

The Query:

insert into
tickets(id,from,department,subject,body,lastaction,lastpost,priority,sta
tus,created,fromname,lastpostname,attach,ct,uniq,notify,replyto)
values(null,'jmckeon','1','test','test
test',unix_timestamp(now()),'"[EMAIL PROTECTED]"
<[EMAIL PROTECTED]>','Medium','Open',unix_timestamp(now()),'Jeff
McKeon','Jeff McKeon','','','ks5hslajdfasd','1','[EMAIL PROTECTED]')

The error: 

You have an error in your SQL syntax near
'from,department,subject,body,lastaction,lastpost,priority,status,create
d,fromnam' at line 1

I suspect it doesn't like the fact that I have a field named "from" but
I KNOW it's possible to write to this table and that field, I just can't
figure out the correct syntax to get it to accept the fieldname "from".

Thanks,

Jeff



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Big Insert query problem

2003-05-27 Thread Ganbold
Hi,

I have FreeBSD 5.1beta with mysql 4.0.13.

When I try to insert 18MB data into myisam table using command "mysql emls 
< big_query", it says "Error 1030 (Got error 12 from table handler)". After 
that myisam table crashes and I have to run mysqlcheck command to fix the 
index.

The query is only one insert query with 18MB of data.

Can somebody suggest me the solution for this?

Thanks in advance,

Ganbold

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]