473,385 Members | 2,005 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,385 software developers and data experts.

create tables from command file

hi,
please correct my terminology if it is incorrect but i am trying to
create a number of tables by writing an sql script/batch file and using
the command:

mysql -D myDB -u myname --password=myPass <
scriptname.sql > err.sql 2>&1

and i am getting errors. the book i am using doesnt seem to cover this
topic well but i think i must be doing something silly that is
preventing the script from running successfully.

i have tried using and not using the single quotes in the following
examples. here is the error i get:

+++++++++++++++++++
ERROR 1064 at line 15: 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 ''User'
(
'userId' varchar(25) not null primary key,
'la

+++++++++++++++++++

here are two entries in the script, one w/ quotes one w/o:

CREATE TABLE 'User'
(
'userId' varchar(25) not null primary key,
'lastName' varchar(25) not null,
'firstName' varchar(25) not null,
'organization' varchar(50) not null,
'phone' char(12),
'email' varchar(25),
'lastLogin' datetime,
);

CREATE TABLE Cookie
(
sessionId char(20),
userId varchar(25) not null references User(UserId),

);

+++++++++++++++++++++++
any thoughts will be appreciated.
tia,
peter


Jul 20 '05 #1
2 1597
picaza wrote:
CREATE TABLE 'User'


MySQL uses backticks (`) to delimit identifiers. Otherwise using
identifiers that clash with SQL reserved words confuses the parser.

Regards,
Bill K.
Jul 20 '05 #2
MySQL uses backticks (`) to delimit identifiers. Otherwise using
identifiers that clash with SQL reserved words confuses the parser.

thanks bill,
i will go try it out now.
seeya,
peter

Jul 20 '05 #3

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

Similar topics

9
by: Lauren Quantrell | last post by:
Is there a way to create a text file (such as a Windows Notepad file) by using a trigger on a table? What I want to do is to send a row of information to a table where the table: tblFileData has...
3
by: anon | last post by:
I have been used to using DAO in the past, and then converted to ADO. Now I am having to use VB.Net(2000) and ADO.NET and am experiencing difficulties with the creation and population of an mdb....
4
by: Brett B | last post by:
Folk, I have mysql installed via rpm package, but when I check the data dirs, the only table there is "test". The instructions say there should be others, like users tables, and other such...
10
by: Zack Sessions | last post by:
Has anyone tried to create a SQL7 view using the CREATE VIEW command and ADO.NET? If so, is there a trick in trapping a SQL error when trying to create the view? I have a VB.NET app that, amoung...
3
by: Madhu | last post by:
All, New to DB2 environment. Can someone share a script that can be used to a create a DB2 UDB database manually. I am trying to create a database on Linux, single partition. Thanks Madhu
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
3
by: Rahul B | last post by:
Hi, I have a user UCLDEV1 which is a part of staff and a group(db2schemagrp1) to which i have not given any permissions. The authorizations of that user are shown as db2 =get authorizations...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.