Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
10-04-2011, 09:50 AM #1
- Join Date
- Oct 2007
- Thanked 0 Times in 0 Posts
Is there anything wrong with my create table statement?
I have an sql query which mysql is giving error:
CREATE TABLE '42011-10-04 08:10:37'(`id` INT NOT NULL AUTO_INCREMENT,PRIMARY KEY(`id`),`url_string` VARCHAR(100),`loadtime` float(10),`comment` VARCHAR(160),`urlflag` INT NOT NULL DEFAULT '0')
ERROR 1064 (42000): 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 '' 42011-10-04 08:10:37'(`id` INT NOT NULL AUTO_INCREMENT,PRIMARY KEY(`id`),`url_' at line 1
10-04-2011, 01:39 PM #2
- Join Date
- Mar 2006
- St. Catharines, Ontario Canada
- Thanked 148 Times in 139 Posts
Yes there is, you can't name your table the way you have. perhaps you can save us time in this forum and get right to the point of why you think you need to name your tables in that manner.
10-04-2011, 11:58 PM #3
Actually, *IF* you are using MySQL, you *can* name a table like that, if you do it right.
You must use BACK TICKS around that table name, *NOT* apostrophes.
The ` back tick usually shares the key with the ~ tilde.
Having said that...Code:CREATE TABLE `42011-10-04 08:10:37` ( .... );
I'm with GuelphDad. What earthly reason would there be for doing something like this?
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.