I am having problems creating a new table with a default and auto
increment such as this...
CREATE TABLE `customer` (
`cust_id` INT( 5 ) DEFAULT '00000' NOT NULL AUTO_INCREMENT ,
`cust_name` VARCHAR( 15 ) NOT NULL ,
`cust_last` VARCHAR( 15 ) NOT NULL ,
PRIMARY KEY ( `cust_id` ) ,
INDEX ( `cust_last` ) ,
FULLTEXT (
) CHARACTER SET = latin1
The error mesg I get is:
MySQL said:
#1067 - Invalid default value for 'cust_id'
If I were to remove the auto increment attribute, it would get created
fine!?
Could anyone direct me to where I can find info on this, whethere it
is syntax related to a step I missed. I know in PostgreSQL, a
variable has to be set up as an incrementer, and then linked to the
field where it will be used. Do I need to do anything along those
lines...
Thankyou,
Ryan 2 2765
Don't make yourself go nuts over this.... a correct INT is a value of 0.
not 000000. Besides that, your first insert of a new record will have
the value of 1, not 00001. If you want 5 digit reference numbers,
you'll have to use a function to pad your int value or switch to varchar
and do it in sw.
Ryan wrote: I am having problems creating a new table with a default and auto increment such as this...
CREATE TABLE `customer` ( `cust_id` INT( 5 ) DEFAULT '00000' NOT NULL AUTO_INCREMENT , `cust_name` VARCHAR( 15 ) NOT NULL , `cust_last` VARCHAR( 15 ) NOT NULL , PRIMARY KEY ( `cust_id` ) , INDEX ( `cust_last` ) , FULLTEXT (
) CHARACTER SET = latin1
The error mesg I get is:
MySQL said:
#1067 - Invalid default value for 'cust_id'
If I were to remove the auto increment attribute, it would get created fine!?
Could anyone direct me to where I can find info on this, whethere it is syntax related to a step I missed. I know in PostgreSQL, a variable has to be set up as an incrementer, and then linked to the field where it will be used. Do I need to do anything along those lines...
Thankyou, Ryan
Don't make yourself go nuts over this.... a correct INT is a value of 0.
not 000000. Besides that, your first insert of a new record will have
the value of 1, not 00001. If you want 5 digit reference numbers,
you'll have to use a function to pad your int value or switch to varchar
and do it in sw.
Ryan wrote: I am having problems creating a new table with a default and auto increment such as this...
CREATE TABLE `customer` ( `cust_id` INT( 5 ) DEFAULT '00000' NOT NULL AUTO_INCREMENT , `cust_name` VARCHAR( 15 ) NOT NULL , `cust_last` VARCHAR( 15 ) NOT NULL , PRIMARY KEY ( `cust_id` ) , INDEX ( `cust_last` ) , FULLTEXT (
) CHARACTER SET = latin1
The error mesg I get is:
MySQL said:
#1067 - Invalid default value for 'cust_id'
If I were to remove the auto increment attribute, it would get created fine!?
Could anyone direct me to where I can find info on this, whethere it is syntax related to a step I missed. I know in PostgreSQL, a variable has to be set up as an incrementer, and then linked to the field where it will be used. Do I need to do anything along those lines...
Thankyou, Ryan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ryan |
last post by:
I am having problems creating a new table with a default and auto
increment such as this...
CREATE TABLE `customer` (
`cust_id` INT( 5 ) DEFAULT '00000' NOT NULL AUTO_INCREMENT ,
`cust_name`...
|
by: ferg |
last post by:
I've checked all the FAQs and help - spent a couple of hours on this
now and it's really bugging me.
I've got Moin 1.3.5 installed on IIS 5.0.
I can view and edit pages without any problems, but...
|
by: expect |
last post by:
Hello,
Trying to get this MySql create table command to work, no luck.
create sequence serial;
CREATE TABLE outbound (
source char(100) default '',
destination char(100) default '',
sport...
|
by: Danny Springer |
last post by:
I am trying to create the following xml file with VS 2005:
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile
xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings"...
|
by: Alicia |
last post by:
Does anyone know why I am getting a "Syntax error in Create Table
statement". I am using Microsoft Access SQL View to enter it. Any
other problems I may run into?
CREATE TABLE weeks
(...
|
by: dog |
last post by:
I've seen plenty of articles on this topic but none of them have been
able to solve my problem.
I am working with an Access 97 database on an NT4.0 machine, which has
many Access reports.
I...
|
by: eskil |
last post by:
Hi,
I want to link products and contacts, products and axctivities and
activities and contacts. I am using one to many links with full
referential integrity. Each table is linked to a table that...
|
by: max |
last post by:
Hello,
I am a newbye, and I'm trying to write a simple application.
I have five tables with three columns; all tables are identical; I need to
change some data in the first table and let VB...
|
by: gweasel |
last post by:
What is the best way to apply a Validation Rule - or rather, where is
the best place to put it? Is there an advantage to putting it on the
field in the table vs setting the validation rule on the...
|
by: PYG |
last post by:
Hi everybody
I have a simple question :
If i use this code :
<body style="font-size:24px;color:blue;">
Text in body
<table>
<tr><td>
Text in table
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
| |