List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:June 1 2002 12:12am
Subject:Re: Column names that contain %
View as plain text  
In the last episode (May 31), David Adam said:
> I have a table that includes numerous column names of the form
> '%_Dry_Weight' -- that is, they start with a
> percent sign.  I am unable to query these columns, as mysql returns a
> "you have an error in your SQL syntax'
> message.  When I try to escape the % character with a backslash, the
> error persists.  If I put the column name in single quotes (e.g., select
> '%_Dry_Weight' from xxx) , the syntax is accepted, but the query returns
> the column name, rather than the values stored.  According to the manual
> for 3.23.41 (which I am using),  all characters are acceptable in column
> names.  I am at an impasse - can anyone steer me in the proper
> direction?  Many thanks!

backtics:  `%_Dry_Weight`

Or use a column name like Pct_Dry_Weight :)

	Dan Nelson
Column names that contain %David Adam1 Jun
  • Re: Column names that contain %Dan Nelson1 Jun