Hi,
I am mass-importing A LOT of csv tables. In order to distinguish between
files I change the default value for the table before doing a load data
infile.. from a Perl script:
ALTER TABLE `data` MODIFY COLUMN `sample_id` INTEGER UNSIGNED NOT NULL
DEFAULT $sample_id[$idx]
After importing
Jagla wrote:
Hi,
I am mass-importing A LOT of csv tables. In order to distinguish between
files I change the default value for the table before doing a load data
infile.. from a Perl script:
ALTER TABLE `data` MODIFY COLUMN `sample_id` INTEGER UNSIGNED NOT NULL
DEFAULT $sample_id[$idx
Hi:
I have a table with a column of type char(120).
default is NULL
How do I a set a 'cell' back to NULL?
Example:
alter customers set all_colslist=NULL where ID=57;
returns a syntax error.
Mysql version 4.0.20
thanks
--
Tim Johnson [EMAIL PROTECTED]
Palmer, Alaska, USA
--
MySQL General Mailing
On Monday 16 April 2007 07:56, Tim Johnson wrote:
Hi:
I have a table with a column of type char(120).
default is NULL
How do I a set a 'cell' back to NULL?
Example:
alter customers set all_colslist=NULL where ID=57;
returns a syntax error.
Mysql version 4.0.20
thanks
This is
Hi everybody
Has some way to set up a function, like now(), as a default value of an
dateTime column.
Is some thing like this.
Create Table Persons (
PersonCode int(10) zerofill not null auto_increment,
PersonName varchar(150) not null,
CadastreDate DateTime not null default now(),
Primary Key
At 9:30 PM -0300 3/13/07, allysonalves wrote:
Hi everybody
Has some way to set up a function, like now(), as a default value of
an dateTime column.
Is some thing like this.
Create Table Persons (
PersonCode int(10) zerofill not null auto_increment,
PersonName varchar(150) not null
The MySQL manual states that as of MySQL 5.0.2 If the
column cannot take NOT NULL as the value, MySQL defines the column with
no explicit DEFAULT clause. How are the default values then backed-up?
I did not see any statements defining the default values. Will I have
to re-create the
the default values. Will I have
to re-create the default values if my database becomes corrupted?
The statement you quote applies in the absence of an explicit DEFAULT
clause that specifies the default value. I don't know what it means
to back up a default value or re-create them, but I'll guess
Jonathan Kart [EMAIL PROTECTED] wrote:
Hi all,
Is it possible in mysql 3.23 to update a row and revert a column back
to its default value. Not the default value for the type, but the
value defined as the column default.
[]
UPDATE pictures SET picture_name=DEFAULT; -- don't think
Hi all,
Is it possible in mysql 3.23 to update a row and revert a column back
to its default value. Not the default value for the type, but the
value defined as the column default.
for example a column is defined as :
picture_name VARCHAR(25) NOT NULL DEFAULT 'no_photo.gif'
if someone removes
Hi David,
Great questions:
- Original Message -
From: David Griffiths
Sent: Friday, May 28, 2004 6:05 PM
Subject: Specifying an index length and the default value
The length of indexes on varchar and char indexes can be specified at
index creation.
What is the default length
-
From: David Griffiths
Sent: Friday, May 28, 2004 6:05 PM
Subject: Specifying an index length and the default value
The length of indexes on varchar and char indexes can be specified at
index creation.
What is the default length of an index if no length is provided?
The default is to index
The length of indexes on varchar and char indexes can be specified at
index creation.
What is the default length of an index if no length is provided?
The High Performance MySQL book hints that the index-length used is
specific for each entry in the indexed column (ie an index on a column
I was wondering if there's a way to set a field to be a pattern of another
field in the same table, ie:
numberfile
1 xyz_1.jpg
2 xyz_2.jpg
3 xyz_3.jpg
.
.
nxyz_n.jpg
I'm achieving this through php but was curious to know if you could do it
James Tusini [EMAIL PROTECTED] wrote:
I was wondering if there's a way to set a field to be a pattern of another
field in the same table, ie:
numberfile
1 xyz_1.jpg
2 xyz_2.jpg
3 xyz_3.jpg
.
.
nxyz_n.jpg
I'm achieving this
At 18:07 +0100 5/18/04, James Tusini wrote:
I was wondering if there's a way to set a field to be a pattern of another
field in the same table, ie:
numberfile
1 xyz_1.jpg
2 xyz_2.jpg
3 xyz_3.jpg
.
.
nxyz_n.jpg
I'm achieving this through php but
Hi all,
When I run the following code the default value isn't being calculated using the concat
and other functions. Instead it is setting the column definition as a string:
CONCAT(TMP
How can I rework this to get a result more like
TMP-T-2
?
USE cro;
CREATE TABLE lpamform
Tim Russell wrote:
Hi all,
When I run the following code the default value isn't being calculated using the concat
and other functions. Instead it is setting the column definition as a string:
CONCAT(TMP
How can I rework this to get a result more like
TMP-T-2
?
You can't.
Default
this done.
I was able to match data types but so far I have not found a way to let the
database handle setting the default value of a datetime field to the
current date/time. Is this possible?
Defaults must be constants, not functions, in MySQL. So, except for the
TIMESTAMP type, the answer
this done.
I was able to match data types but so far I have not found a way to let the
database handle setting the default value of a datetime field to the
current date/time. Is this possible?
Defaults must be constants, not functions, in MySQL. So, except for the
TIMESTAMP type, the answer
that currently uses SQLServer but will be using MySQL soon
as I can get this done.
I was able to match data types but so far I have not found a way to let the
database handle setting the default value of a datetime field to the
current date/time. Is this possible?
Defaults must be constants
to
MySQL. I have a
web application that currently uses SQLServer but will be
using MySQL soon
as I can get this done.
I was able to match data types but so far I have not found a
way to let the
database handle setting the default value of a datetime field to the
current date/time
On Mon, 19 Apr 2004 17:36:50 -0500, Paul DuBois wrote:
Sorry if I wasn't clear. One of the things you wanted to do was have
a column that is set automatically to record-creation time when the
record is created, but not updated automatically when the record is
updated later. You will be
At 20:23 -0400 4/19/04, Stormblade wrote:
On Mon, 19 Apr 2004 17:36:50 -0500, Paul DuBois wrote:
Sorry if I wasn't clear. One of the things you wanted to do was have
a column that is set automatically to record-creation time when the
record is created, but not updated automatically when the
the default value of a datetime field to the
current date/time. Is this possible?
In my research I found 2 main suggestions:
1. Use timestamp. While this suggestion is good for my modified fields
it
is not really suitable for the others which basically will get set
once and
that's it.
2. Use datetime
the same database? With SQLServer this isn't a
problem. Currently with MySQL it is. Although I hear that verion 5 will
support stored procedures. Perhaps that will be a workaround for that
situation, although it would be much nicer IMO to simply allow us to
specify a function/macro for a default value
setting the default value of a datetime field to the
current date/time. Is this possible?
Defaults must be constants, not functions, in MySQL. So, except for the
TIMESTAMP type, the answer is no.
In my research I found 2 main suggestions:
1. Use timestamp. While this suggestion is good for my
types but so far I have not found a way to let the
database handle setting the default value of a datetime field to the
current date/time. Is this possible?
Defaults must be constants, not functions, in MySQL. So, except for the
TIMESTAMP type, the answer is no.
I suspected as much. I
make a
final choice of the datatype.
Rhino
- Original Message -
From: Stormblade [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, April 18, 2004 1:30 PM
Subject: Re: Datetime Default Value
On Sun, 18 Apr 2004 12:17:00 -0400, Michael Stassen wrote:
Stormblade wrote:
Hey all
to match data types but so far I have not found a way to let the
database handle setting the default value of a datetime field to the
current date/time. Is this possible?
Defaults must be constants, not functions, in MySQL. So, except for the
TIMESTAMP type, the answer is no.
I suspected as much. I
On Sun, 18 Apr 2004 13:54:22 -0400, Rhino wrote:
Stormblade (and anyone watching this thread),
Just watch yourself when deciding between DATETIME and TIMESTAMP; the two
datatypes support very different ranges of values!
Thanks for the heads up!
According to the manual, DATETIME can
.
Goodness!
But, you need to know that MySQL behaves differently than you expect with
respect to NOT NULL columns. Because it supports non-transactional table
types, every column in MySQL has a default value, even NOT NULL columns.
Not Goodness. :(
Hence, if you leave out the date column
Hey all,
I'm currently converting a SQLServer 2000 database over to MySQL. I have a
web application that currently uses SQLServer but will be using MySQL soon
as I can get this done.
I was able to match data types but so far I have not found a way to let the
database handle setting the default
Hi,
How to run script at mysql prompt?
Like if i want to create a table or select some query and I want to put those sql
statement into one file ,how to run that and what would be the extention of that query?
I want to create on column which contains only default value TRUE or False.how to do
mysql -ppassword -u username -e shell commands for sql like select
that can be runned from any shell script.
use enum to check Y/N TRUE/FALSE etc.
CREATE TABLE testtest (
test ENUM( 'TRUE', 'FALSE' ) NOT NULL
);
it automaticly sets true as default value with me.
otherwise add:
DEFAULT 'FALSE
I use MYSQL 4. I can modify or alter a column with no problems. But how I
can alter table and setup Default value. The column below has default value
NULL, but I want to setup default value used. How that's can be done?
type | enum('new',used') | YES | | NULL
Hi Mike,
It's just part of modifying the column to change the DEFAULT value.
e.g. you might use this (changes to NOT NULL and DEFAULT value of
'new'):
ALTER TABLE table MODIFY type ENUM('new','used') NOT NULL DEFAULT 'new';
Hope that helps.
Matt
- Original Message -
From: Mike
This worked for me:
ALTER TABLE `test` CHANGE `somefield` `somefield` enum('new','used') DEFAULT 'new'
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Hello ALL
(B
(B
(BHow can a dataset return the default value from the
(Bdatabase(MySQL,MSSQL, Interbase).
(BI have try in ADO, dbx, BDE, and the result is not,
(BHow Can I do?
(B
(B
(B--
(BMySQL General Mailing List
(BFor list archives: http://lists.mysql.com/mysql
(BTo
Daevid Vincent [EMAIL PROTECTED] wrote:
I have my schema set so that a field in a table has a default value of 16.
I also have a script that initializes the database, but I don't want to
delete the record since I want the other fields' data preserved. Is there a
way to find out what
I have my schema set so that a field in a table has a default value of 16.
I also have a script that initializes the database, but I don't want to
delete the record since I want the other fields' data preserved. Is there a
way to find out what the default schema value is so that I can issue
Hi all,
I pretty much set a fields default value to NULL if it not a required
field in my app. Just wondering if this is the way to go since I just
sort of guessed at this method ;)
- Charles
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http
Hello:
I'm using version 3.23.41.
How may I change the default value of
an existing table?
(type will remain the same)
Pointers to docs are welcome and invited.
thanks
tim
--
Tim Johnson [EMAIL PROTECTED]
http://www.alaska-internet-solutions.com
http
At 9:02 -0800 7/16/03, Tim Johnson wrote:
Hello:
I'm using version 3.23.41.
How may I change the default value of
an existing table?
(type will remain the same)
Pointers to docs are welcome and invited.
thanks
tim
--
Tim Johnson [EMAIL PROTECTED]
http
] / 2003-06-24 09:46:24 +1000:
I am using LOAD DATA INFILE to import some data to MySQL. I would
like to leave some fields blank and use the default value set in
the tables. I have spent many hours trying to find the problem,
but no luck so far. According to the manual, it should work. I
-
From: Roman Neuhauser [EMAIL PROTECTED]
To: Ruth Zhai [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, June 24, 2003 7:50 PM
Subject: Re: default value does not set using LOAD DATA INFILE ...
please don't piggyback on other people's threads. you can start your
own for free
Hi Everyone,
I am using LOAD DATA INFILE to import some data to MySQL. I would like to
leave some fields blank and use the default value set in the tables. I have
spent many hours trying to find the problem, but no luck so far. According
to the manual, it should work. I am hoping some one
[EMAIL PROTECTED]
To: Bhavin Vyas [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, March 30, 2003 9:44 PM
Subject: Re: Help With Default Value
Ok, how do I get the MAX(id)?
Thanks,
Richard
- Original Message -
From: Bhavin Vyas [EMAIL PROTECTED]
To: MySQL List [EMAIL PROTECTED]; [EMAIL
I am trying to do one of two things.
First I'd rather do this, but if not possible, then the other way that
I'll describe will suffice.
1) I need to have a default value of a column named invoice_id be this:
Column names of importance:
idinvoice_id
id is auto_increment and BIGINT unsigned
PM
Subject: Help With Default Value
I am trying to do one of two things.
First I'd rather do this, but if not possible, then the other way that
I'll describe will suffice.
1) I need to have a default value of a column named invoice_id be this:
Column names of importance:
idinvoice_id
id
Value
Ok, how do I get the MAX(id)?
Thanks,
Richard
- Original Message -
From: Bhavin Vyas [EMAIL PROTECTED]
To: MySQL List [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, March 30, 2003 7:59 PM
Subject: Re: Help With Default Value
First option, I don't think
Perhaps TIMESTAMP will provide what you need.
Daevid Vincent wrote:
http://www.mysql.com/doc/en/CREATE_TABLE.html states Default values must be
constants. This means, for example, that you cannot set the default for a
date column to be the value of a function such as NOW() or CURRENT_DATE.
Is
http://www.mysql.com/doc/en/CREATE_TABLE.html states Default values must be
constants. This means, for example, that you cannot set the default for a
date column to be the value of a function such as NOW() or CURRENT_DATE.
Is this ever going to be fixed? I often find myself using this when
At 17:56 -0800 3/5/03, Daevid Vincent wrote:
http://www.mysql.com/doc/en/CREATE_TABLE.html states Default values must be
constants. This means, for example, that you cannot set the default for a
date column to be the value of a function such as NOW() or CURRENT_DATE.
Is this ever going to be
Hello All:
(using MYSQL Ver 11.15 Distrib 3.23.41
for redhat-linux-gnu (i386) (RH 7.2))
I am importing text data (but in a numeric format).
The customers wants 'N/A' in an empty field.
Additionally:
The customer wishes that if a field = ''
the default value of 'N
= ''
the default value of 'N/A' be substituted.
Is this possible to do in MySQL?
Sure, but not with LOAD DATA. You can either preprocess the data file
beforehand, or do this after import:
UPDATE TABLE t SET col = 'N/A' IF col = '' OR col = '';
Documentation?
Regards
--
Tim Johnson
Tim,
I am importing text data (but in a numeric format).
The customers wants 'N/A' in an empty field.
Additionally:
The customer wishes that if a field = ''
the default value of 'N/A' be substituted.
Is this possible to do in MySQL?
Documentation?
AFAIK there's no way
On Mon, Jan 27, 2003 at 10:04:07PM -0500, Carlin Anderson wrote:
I am running mysql 3.23, and want to know if I can set the default value
of a column to to_days(now()), or the equivelant. I have tried this,
and the default gets translated to 0.
You cannot.
--
Jeremy D. Zawodny | Perl
On Tuesday 28 January 2003 05:04, Carlin Anderson wrote:
I am running mysql 3.23, and want to know if I can set the default value
of a column to to_days(now()), or the equivelant. I have tried this,
and the default gets translated to 0.
Nope. Default column value must be constant
I am running mysql 3.23, and want to know if I can set the default value
of a column to to_days(now()), or the equivelant. I have tried this,
and the default gets translated to 0.
Thanks
Carlin
-
Before posting, please check
Hi,
Can anybody tell me is it possible in the my sql to set the function as
default value, for example can i set the now() function for the date column
field.
Thanks in advance.
Regards
Daya Krishan Dubey
Core Solucomm Ltd
423 B, Hamilton court
DLF phase IV
Gurgaon, India
Ph# 91-124-6392896/7
Daya,
Friday, September 28, 2001, 10:36:30 AM, you wrote:
DKD Can anybody tell me is it possible in the my sql to set the function as
DKD default value, for example can i set the now() function for the date column
DKD field.
No, you can't:
http://www.mysql.com/doc/en/CREATE_TABLE.html
Is there a wat to have mySQL auto fill in the current date into my
dateCreated field?
In SQLServer I would simply specify the getDate() method as a default value.
I presume I would use the analogous MySQL function curDate() but it does not
appear to work for me.
Any suggestions
Check TIMESTAMP type in the documentation.
Best regards,
Mikhail.
- Original Message -
From: neal [EMAIL PROTECTED]
To: mySQL [EMAIL PROTECTED]
Sent: Wednesday, September 18, 2002 10:32 AM
Subject: date field - default value = current date
Is there a wat to have mySQL auto fill
neal,
Wednesday, September 18, 2002, 11:32:39 AM, you wrote:
n Is there a wat to have mySQL auto fill in the current date into my
n dateCreated field?
n In SQLServer I would simply specify the getDate() method as a default value.
n I presume I would use the analogous MySQL function curDate
At 1:32 -0700 9/18/02, neal wrote:
Is there a wat to have mySQL auto fill in the current date into my
dateCreated field?
In SQLServer I would simply specify the getDate() method as a default value.
I presume I would use the analogous MySQL function curDate() but it does not
appear to work for me
Hello,
s possible to create table with default value returned by built-in
function ??
like:
create table x (a int not null default UNIX_TIMESTAMP());
When inserting new column in table field a will contains timestamp?
sql,query
Regards,
Michal Dvoracek [EMAIL
Michal Dvoracek wrote:
Hello,
s possible to create table with default value returned by built-in
function ??
like:
No.
create table x (a int not null default UNIX_TIMESTAMP());
What is wrong with the timestamp field type?
When inserting new column in table field a will contains
From: Michal Dvoracek [EMAIL PROTECTED]
s possible to create table with default value returned by built-in
function ??
like:
create table x (a int not null default UNIX_TIMESTAMP());
When inserting new column in table field a will contains timestamp?
In general, this cannot be done
Can I have a default value call a function in a MYSQL table for example
convert(float,getdate())
Kathy Reyes
Live Technology International
2975 Westchester Avenue
Suite 103
Purchase, NY 10577
Tel: (914) 490-7096
[EMAIL PROTECTED]
www.LiveTechnology.com
On Mon, Mar 18, 2002 at 05:32:07PM -0500, Kathy Reyes wrote:
Can I have a default value call a function in a MYSQL table for example
convert(float,getdate())
Nope.
--
Jeremy D. Zawodny, [EMAIL PROTECTED]
Technical Yahoo - Yahoo Finance
Desk: (408) 349-7878 Fax: (408) 349-5454 Cell: (408
I'm trying to create at table that inserts a default value into a field if
nothing is supplied. If in interpret the documentation correctly this should
be accomplished by something like this:
CREATE TABLE Location (LocationID VARCHAR(10) NOT NULL PRIMARY KEY, Name
VARCHAR(50), Address1 VARCHAR
On Sun, 2001-11-04 at 13:52, Chris Williams wrote:
I'm trying to create at table that inserts a default value into a field if
nothing is supplied. If in interpret the documentation correctly this should
be accomplished by something like this:
CREATE TABLE Location (LocationID VARCHAR(10
I suggest a few things. First, set it to NOT NULL DEFAULT 1, and then set
the value explicitly to null, which will cause it to use the default value.
The problem with inserting '' is that its casting to an integer and mysql
decides that '' should be 0. Or try using : insert into table (column1
Hi Monty,
I've been experimenting with ENUM NOT NULL columns without a default
value. The documentation (section 6.5.3 again) states:
If no DEFAULT value is specified for a column, MySQL automatically
assigns one. If the column may take NULL as a value, the default value is
NULL. If the column
At 2:43 AM +0100 10/1/01, Corin Hartland-Swann wrote:
Hi Monty,
I've been experimenting with ENUM NOT NULL columns without a default
value. The documentation (section 6.5.3 again) states:
If no DEFAULT value is specified for a column, MySQL automatically
assigns one. If the column may take NULL
Hi,
When I try to give a default value in an enum field with a string
containing extented ascii value (i.e. higher than 128), I get an 'Invalid
default value for enum_field' error. For instance, the command:
alter table MyTable add AnEnumField enum('Employé', 'Producteur
"JSB" == Jamie S Buchanan [EMAIL PROTECTED] writes:
JSB More specifically, I have two DateTime fields (A and B), in my creation
JSB script I want to set the default value of B to the value of A so that
JSB when I write a new record to the table the position of B can be left
wh
to intially be set to a value of another DateTime field?
More specifically, I have two DateTime fields (A and B), in my creation
script I want to set the default value of B to the value of A so that
when I write a new record to the table the position of B can be left
NULL, or equivalent, but the value
of another DateTime field?
More specifically, I have two DateTime fields (A and B), in my creation
script I want to set the default value of B to the value of A so that
when I write a new record to the table the position of B can be left
NULL, or equivalent, but the value of A will be stored in it's
?
More specifically, I have two DateTime fields (A and B), in my creation
script I want to set the default value of B to the value of A so that
when I write a new record to the table the position of B can be left
NULL, or equivalent, but the value of A will be stored in it's place. I
later
On Fri, 23 Feb 2001 15:54:03 +0100, Yong Li [EMAIL PROTECTED]
wrote:
Hi,
I wanted to create a column with type set, and to specify a default
value for this column, but I always got either SQL syntax error or
invalid default value error. What is the right syntax for doing this?
or, it's
I would like to set a default value in DATE type column to Date(), but it
doesn't work. Is there a way to do it through column format?
If not, what should I enter in the VB code below (place where I need help
will have )
Private Sub okButton_Click()
Dim db As Database
Dim
Use the timestamp datatype, not date.
At 02:43 PM 1/15/2001 -0600, Apolinaras \"Apollo\" Sinkevicius wrote:
I would like to set a default value in DATE type column to Date(), but it
doesn't work. Is there a way to do it through column format?
If not, what should I enter in the VB
Hi. This is a really easy question:
I have an existing table called clients. I have an existing field called
CPicture. I'm trying to add a default value of "no".
I've tried several times and can't seem to get it right. So, does anyone
know how I can add a def
Hi. This is a really easy question:
I have an existing table called clients. I have an existing field called
CPicture. I'm trying to add a default value of "no".
I've tried several times and can't seem to get it right. So, does anyone
know how I can add a def
86 matches
Mail list logo