473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

creating table - can't


I've read around, especially at mysql.com to see if there are any
limitations to tablenames, one is 64 characters and the other one seems to
be that a tablename can't exist only numeric.

So, within PHP I try to create a table with name "12345-name" and it fails
entirely.

It get's me rather puzzled as it should be possible according to the mysql
manual.
Of course, the table definition follows as it should. If i change the
tablename to only "name" .. then I can create the table under Mysql
4.0.11a.
But I want my tablenames to consist of faxnumber-name, nothing else.

Is there anything I missed somewhere that prevents me from doing what I
want?

I'm sorta confused here ...

/Andreas

--
Registeret Linux user #292411
Jul 17 '05 #1
10 2897
Works fine for me... just tried it with phpMyAdmin... try not using quotes,
or single quotes? Then again I do believe im on MySQL 3.X... maybe thats
it?
-Eric Kincl

Andreas Paasch wrote:

I've read around, especially at mysql.com to see if there are any
limitations to tablenames, one is 64 characters and the other one seems to
be that a tablename can't exist only numeric.

So, within PHP I try to create a table with name "12345-name" and it fails
entirely.

It get's me rather puzzled as it should be possible according to the mysql
manual.
Of course, the table definition follows as it should. If i change the
tablename to only "name" .. then I can create the table under Mysql
4.0.11a.
But I want my tablenames to consist of faxnumber-name, nothing else.

Is there anything I missed somewhere that prevents me from doing what I
want?

I'm sorta confused here ...

/Andreas


Jul 17 '05 #2
On Mon, 10 Nov 2003 23:39:34 +0100, Andreas Paasch <An*****@Paasch.Net> wrote:
I've read around, especially at mysql.com to see if there are any
limitations to tablenames, one is 64 characters and the other one seems to
be that a tablename can't exist only numeric.

So, within PHP I try to create a table with name "12345-name" and it fails
entirely.
Post error messages and example code.

To create a table with a bad name like that requires quotes around the name.
The type of quotes depends on with what options the MySQL server was started.
If you ever need to quote identifiers, it almost always means you chose a bad
name for the identifier...
It get's me rather puzzled as it should be possible according to the mysql
manual.
Of course, the table definition follows as it should. If i change the
tablename to only "name" .. then I can create the table under Mysql
4.0.11a.
But I want my tablenames to consist of faxnumber-name, nothing else.


Why are you encoding data in the table name?

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #3
Andy Hassall wrote:
On Mon, 10 Nov 2003 23:39:34 +0100, Andreas Paasch <An*****@Paasch.Net>
wrote:
[snip]
Post error messages and example code.
Sorry, I decided not to post those as I didn't think they were of value as I
know the problem lies in the naming structure of the table to create ..
just showing it here anyways, just in case ....

Code part:
$query = "CREATE TABLE '$folder'
... then follows the table definition ...
in this instance is exactly $folder = "38747117-robertos"

[errormsg]
right syntax to use near ''38747117-robertos'
[/errormsg]

As mentioned, if I replace '$folder' with petersen, the table is created
perfectly, so it's gotta be the name of the table.

To create a table with a bad name like that requires quotes around the
name.
The type of quotes depends on with what options the MySQL server was
started. If you ever need to quote identifiers, it almost always means you
chose a bad name for the identifier...

[snip]

It's actually not data, it's a faxnumber to distinguish several conflicting
names. No workaround for the name ...

--
Registeret Linux user #292411
Jul 17 '05 #4
Semicolon?? Can't forget those little POSes now, can we?
-Eric Kincl

Andreas Paasch wrote:
Andy Hassall wrote:
On Mon, 10 Nov 2003 23:39:34 +0100, Andreas Paasch <An*****@Paasch.Net>
wrote:

[snip]

Post error messages and example code.


Sorry, I decided not to post those as I didn't think they were of value as
I know the problem lies in the naming structure of the table to create ..
just showing it here anyways, just in case ....

Code part:
> $query = "CREATE TABLE '$folder'
... then follows the table definition ...

in this instance is exactly $folder = "38747117-robertos"

[errormsg]
right syntax to use near ''38747117-robertos'
[/errormsg]

As mentioned, if I replace '$folder' with petersen, the table is created
perfectly, so it's gotta be the name of the table.

To create a table with a bad name like that requires quotes around the
name.
The type of quotes depends on with what options the MySQL server was
started. If you ever need to quote identifiers, it almost always means
you chose a bad name for the identifier...

[snip]

It's actually not data, it's a faxnumber to distinguish several
conflicting names. No workaround for the name ...


Jul 17 '05 #5
On Tue, 11 Nov 2003 00:02:09 +0100, Andreas Paasch <An*****@Paasch.Net> wrote:
Andy Hassall wrote:
On Mon, 10 Nov 2003 23:39:34 +0100, Andreas Paasch <An*****@Paasch.Net>
wrote:
[snip]

Post error messages and example code.


Sorry, I decided not to post those as I didn't think they were of value as I
know the problem lies in the naming structure of the table to create ..
just showing it here anyways, just in case ....

Code part:
> $query = "CREATE TABLE '$folder'
... then follows the table definition ...


Single quotes '' are for string literals, not identifiers.

In ANSI mode, quoted identifiers are surrounded by double quotes "" (as in
many other databases).

MySQL tends to use backticks `` though.

See the manual.
http://www.mysql.com/documentation/m...ml#Legal_names
in this instance is exactly $folder = "38747117-robertos"

[errormsg]
right syntax to use near ''38747117-robertos'
[/errormsg]
Doesn't look like a MySQL 3.x error, what version are you running? You're also
missing the start of the error message.
It's actually not data, it's a faxnumber to distinguish several conflicting
names. No workaround for the name ...


You could always put the number at the end and drop the '-' so it's a normal
name, e.g. robertos38747117.

Looks like 'robertos' is a case of encoding data in a name too, then?

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #6
Andy Hassall wrote:
On Tue, 11 Nov 2003 00:02:09 +0100, Andreas Paasch <An*****@Paasch.Net>
wrote:

[snip]

Single quotes '' are for string literals, not identifiers.

In ANSI mode, quoted identifiers are surrounded by double quotes "" (as
in
many other databases).

MySQL tends to use backticks `` though.

See the manual.
http://www.mysql.com/documentation/m...ml#Legal_names


The backtic did the trick ... first time I realized that a single quote
isn't a single quote, it's actually a backtick.

Thanks a lot.

/Andreas

--
Registeret Linux user #292411
Jul 17 '05 #7
Andreas Paasch wrote:
So, within PHP I try to create a table with name "12345-name" and it fails
entirely.


Can I assume you are creating tables at runtime?
Unless you are explicityly doing this to handle bulk ware-house type
stuff, then you'r probably going about things the wrong way. You should
be able to scale your data without need to add entities (ie. modify your
data structure).

What is it that you are really trying to do?
Jul 17 '05 #8
Terence wrote:
Andreas Paasch wrote:
So, within PHP I try to create a table with name "12345-name" and it
fails entirely.


Can I assume you are creating tables at runtime?
Unless you are explicityly doing this to handle bulk ware-house type
stuff, then you'r probably going about things the wrong way. You should
be able to scale your data without need to add entities (ie. modify your
data structure).

What is it that you are really trying to do?

What I'm really trying to do is write some administrative pages that handle
my import and selection of data based on a cvs-file.

As I assume to get more and more customer into my system, it's a lot easier
to automate the procedure.
So I create a customer and import that customers cvs-file according to a
very special structure which is written into the cvs-filename.
That file name in turn is split and creates then the folder structure for
easy access later on and in order to keep consensus.

I doubt I go about it the wrong way, just lack some in-depth understanding
....

/Andreas

--
Registeret Linux user #292411
Jul 17 '05 #9
On Tue, 11 Nov 2003 10:44:55 +0100, Andreas Paasch
<An*****@Paasch.Net> wrote:
What I'm really trying to do is write some administrative pages that handle
my import and selection of data based on a cvs-file.

As I assume to get more and more customer into my system, it's a lot easier
to automate the procedure.
So I create a customer and import that customers cvs-file according to a
very special structure which is written into the cvs-filename.
That file name in turn is split and creates then the folder structure for
easy access later on and in order to keep consensus.


I think you're equating database tables to filesystem folders. A
relational database isn't a filesystem. If you are creating customers,
you should have a single `customer` entity (table).

This table would have fields such as customer id, name, etc.

As you create customers, add records to this table.

Your database design should reflect the logical view of the data, as
opposed to how it is physically stored.

--
David ( @priz.co.uk )
The Internet Prisoner Database: http://www.priz.co.uk/ipdb/
The Tarbrax Chronicle: http://www.tarbraxchronicle.com/
Jul 17 '05 #10
Andreas Paasch wrote:
Terence wrote:

Andreas Paasch wrote:

So, within PHP I try to create a table with name "12345-name" and it
fails entirely.


Can I assume you are creating tables at runtime?
Unless you are explicityly doing this to handle bulk ware-house type
stuff, then you'r probably going about things the wrong way. You should
be able to scale your data without need to add entities (ie. modify your
data structure).

What is it that you are really trying to do?


What I'm really trying to do is write some administrative pages that handle
my import and selection of data based on a cvs-file.

As I assume to get more and more customer into my system, it's a lot easier
to automate the procedure.
So I create a customer and import that customers cvs-file according to a
very special structure which is written into the cvs-filename.
That file name in turn is split and creates then the folder structure for
easy access later on and in order to keep consensus.

I doubt I go about it the wrong way, just lack some in-depth understanding
...

/Andreas


You don't want a relational database system, you want a native XML
database system.

http://xml.apache.org/xindice/
or
http://exist.sourceforge.net/

There are commercial ones if you need hardcore scalability. Tamino is
the best one I've seen -- it's not cheap.
Jul 17 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
by: Neil | last post by:
I have an Access 2000 MDB with ODBC linked tables to a SQL Server 7 back end. I currently have a selections table in the front end file which the users use to make selections of records. The table...
7
by: John Baker | last post by:
Hi: I would like to know how to create a temp DB to store the data in a table while I do something else with the table. Specifically, how do I create the temp remove the temp I want to be...
8
by: Nanda | last post by:
hi, I am trying to generate parameters for the updatecommand at runtime. this.oleDbDeleteCommand1.CommandText=cmdtext; this.oleDbDeleteCommand1.Connection =this.oleDbConnection1;...
3
by: m3ckon | last post by:
Hi there, I can succesfully create a word doc from my asp.net page, but I have 2 issues I need to resolve in order to use it in my app: 1) Creating a table: I seem unable to create a table,...
4
by: Coleen | last post by:
Hi All :-) Can anyone give me a URL where I can find a good example of code on how to create a temporary SQL table using VB.net? I've checked the Microsoft site at: ...
5
by: John | last post by:
I have 2 tables, one with dates and information about those dates, and one with people information. I want to create a report listing each date and the people who attended on that date (who have...
16
by: pukivruki | last post by:
hi, I wish to create a temporary table who's name is dynamic based on the argument. ALTER PROCEDURE . @PID1 VARCHAR(50), @PID2 VARCHAR(50), @TICKET VARCHAR(20)
2
by: astolpho | last post by:
I am using a slightly outdated reference book on J2EE programming. It gives 2 methods of creating a database used in its casestudies. The first is an ANT script that gives the following output: ...
2
by: djpaul | last post by:
Hello, I have this program and when i want to load pictures it crashes at the form.showdialog()....??? Here it goes: Private Sub CmbPath_SelectedIndexChanged(ByVal sender As Object, ByVal e As...
6
by: firefighter17103 | last post by:
Hi All, I am new to MS Access 07, & do not know any VB, on a new business adventure. I am running Office07 on Vista Home Premium. I am in the process of creating a database that in the end I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.