LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-04-2003, 12:11 PM   #1
sk8guitar
Member
 
Registered: Jul 2003
Location: DC
Distribution: mandrake 9.1
Posts: 415

Rep: Reputation: 30
mysql


i know its not a programming language, but i basically ask all my computer questions in this board anyways.

i managed to create a table in mysql that has a name "2". i want to get rid of that sucker, but going "drop table 2" doesn't work.

is there any way to do this?
 
Old 08-04-2003, 12:17 PM   #2
MartBrooks
Member
 
Registered: May 2002
Location: London
Distribution: Debian
Posts: 388

Rep: Reputation: 31
Did you type "drop table 2" or "drop table 2;" ?
 
Old 08-04-2003, 01:44 PM   #3
sk8guitar
Member
 
Registered: Jul 2003
Location: DC
Distribution: mandrake 9.1
Posts: 415

Original Poster
Rep: Reputation: 30
i mean i put in the semi colon. it gave me an error.
 
Old 08-04-2003, 01:44 PM   #4
sk8guitar
Member
 
Registered: Jul 2003
Location: DC
Distribution: mandrake 9.1
Posts: 415

Original Poster
Rep: Reputation: 30
Code:
mysql> drop table 2;
ERROR 1064: You have an error in your SQL syntax near '2' at line 1
mysql> drop table "2";
ERROR 1064: You have an error in your SQL syntax near '"2"' at line 1
mysql> drop table '2';
ERROR 1064: You have an error in your SQL syntax near ''2'' at line 1
mysql>
 
Old 08-04-2003, 03:35 PM   #5
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
i think its got something to do with the fact 2 is a number and not a string but if thats the case im confused as to how you created the table in the first place. also i dont know if mysql accepts lower case commands because sql commands should technically be in upper case. can you post how you created the table?
 
Old 08-04-2003, 03:56 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
You need to use backticks:
drop table `2`;
 
Old 08-05-2003, 07:55 AM   #7
sk8guitar
Member
 
Registered: Jul 2003
Location: DC
Distribution: mandrake 9.1
Posts: 415

Original Poster
Rep: Reputation: 30
rock on, it worked.

well the way i made it was through a php script. what it did was take the "playlist ID" from the master playlist table and use that ID to make a new table with that name that would hold hte playlist for that dj.

the backticks worked great. thanks david. much appreciated
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 02:13 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 07:19 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 01:52 AM
Problems with MySQL on SuSE: Can't Connect (/var/lib/mysql/mysql.sock) neocookie Linux - Software 8 02-07-2008 11:48 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration