473,785 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can't create this table with datetime column, why?

I am unable to determine which version of mySQL is running on a remote
server (and the client doesn't know either, and I can't reach the host.. oh
what I'll do for $80)...

create table if not exists fs_usermetadata (
fs_userid int not null,
primary key(fs_userid),
fs_username varchar(255) not null,
fs_password varchar(255) not null,
fs_user_categor y_id int not null,
fs_user_firstna me varchar(255),
fs_user_lastnam e varchar(255),
fs_user_address 1 varchar(255),
fs_user_address 2 varchar(50),
fs_user_city varchar(255),
fs_user_state_p rovince varchar(3),
fs_user_zip_pos tal varchar(20),
fs_user_country varchar(3),
fs_user_homepho ne varchar(50),
fs_user_workpho ne varchar(50),
fs_user_fax varchar(50),
fs_user_isHome varchar(1) not null,
fs_user_ip varchar(15),
fs_record_enter ed datetime default NOW(),
fs_payment_meth od varchar(10) not null
);

Can any of you determine why the fs_record_enter ed column call continually
produces a SQL error? I am trying to set it to default to now() and it fails
every time. Augh!

Thanx
Phil
Jul 19 '05 #1
3 10377
Phil Powell wrote:
I am unable to determine which version of mySQL is running on a remote
server (and the client doesn't know either, and I can't reach the host..
oh what I'll do for $80)...

create table if not exists fs_usermetadata (
fs_userid int not null,
primary key(fs_userid),
fs_username varchar(255) not null,
fs_password varchar(255) not null,
fs_user_categor y_id int not null,
fs_user_firstna me varchar(255),
fs_user_lastnam e varchar(255),
fs_user_address 1 varchar(255),
fs_user_address 2 varchar(50),
fs_user_city varchar(255),
fs_user_state_p rovince varchar(3),
fs_user_zip_pos tal varchar(20),
fs_user_country varchar(3),
fs_user_homepho ne varchar(50),
fs_user_workpho ne varchar(50),
fs_user_fax varchar(50),
fs_user_isHome varchar(1) not null,
fs_user_ip varchar(15),
fs_record_enter ed datetime default NOW(),
fs_payment_meth od varchar(10) not null
);

Can any of you determine why the fs_record_enter ed column call continually
produces a SQL error? I am trying to set it to default to now() and it
fails every time. Augh!

Thanx
Phil

From the MySQL Online Manual(http://www.mysql.com/doc/en/CREATE_TABLE.html)
"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."

--
--PC
"Of course, that's just my opnion. I might be wrong"
Jul 19 '05 #2
Phil Powell wrote:
I am unable to determine which version of mySQL is running on a remote
server (and the client doesn't know either, and I can't reach the host..
oh what I'll do for $80)...

create table if not exists fs_usermetadata (
fs_userid int not null,
primary key(fs_userid),
fs_username varchar(255) not null,
fs_password varchar(255) not null,
fs_user_categor y_id int not null,
fs_user_firstna me varchar(255),
fs_user_lastnam e varchar(255),
fs_user_address 1 varchar(255),
fs_user_address 2 varchar(50),
fs_user_city varchar(255),
fs_user_state_p rovince varchar(3),
fs_user_zip_pos tal varchar(20),
fs_user_country varchar(3),
fs_user_homepho ne varchar(50),
fs_user_workpho ne varchar(50),
fs_user_fax varchar(50),
fs_user_isHome varchar(1) not null,
fs_user_ip varchar(15),
fs_record_enter ed datetime default NOW(),
fs_payment_meth od varchar(10) not null
);

Can any of you determine why the fs_record_enter ed column call continually
produces a SQL error? I am trying to set it to default to now() and it
fails every time. Augh!

Thanx
Phil

From the MySQL Online Manual(http://www.mysql.com/doc/en/CREATE_TABLE.html)
"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."

--
--PC
"Of course, that's just my opnion. I might be wrong"
Jul 19 '05 #3
Phil Powell wrote:
I am unable to determine which version of mySQL is running on a remote
server (and the client doesn't know either, and I can't reach the host..
oh what I'll do for $80)...

create table if not exists fs_usermetadata (
fs_userid int not null,
primary key(fs_userid),
fs_username varchar(255) not null,
fs_password varchar(255) not null,
fs_user_categor y_id int not null,
fs_user_firstna me varchar(255),
fs_user_lastnam e varchar(255),
fs_user_address 1 varchar(255),
fs_user_address 2 varchar(50),
fs_user_city varchar(255),
fs_user_state_p rovince varchar(3),
fs_user_zip_pos tal varchar(20),
fs_user_country varchar(3),
fs_user_homepho ne varchar(50),
fs_user_workpho ne varchar(50),
fs_user_fax varchar(50),
fs_user_isHome varchar(1) not null,
fs_user_ip varchar(15),
fs_record_enter ed datetime default NOW(),
fs_payment_meth od varchar(10) not null
);

Can any of you determine why the fs_record_enter ed column call continually
produces a SQL error? I am trying to set it to default to now() and it
fails every time. Augh!

Thanx
Phil

From the MySQL Online Manual(http://www.mysql.com/doc/en/CREATE_TABLE.html)
"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."

--
--PC
"Of course, that's just my opnion. I might be wrong"
Jul 19 '05 #4

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

Similar topics

0
535
by: Phil Powell | last post by:
I am unable to determine which version of mySQL is running on a remote server (and the client doesn't know either, and I can't reach the host.. oh what I'll do for $80)... create table if not exists fs_usermetadata ( fs_userid int not null, primary key(fs_userid), fs_username varchar(255) not null, fs_password varchar(255) not null, fs_user_category_id int not null,
4
4437
by: Michael Jackson | last post by:
I have a stored procedure to create a table. In my program I want the user to name the table to be created, therefore I pass a parameter to the SP for the table name. I cannot get it to work. It creates a table called "@NewTableName". Any ideas? CREATE PROCEDURE dbo.sp_FFProduction_CreateTable (
9
2929
by: Vorpal | last post by:
Here is a small sample of data from a table of about 500 rows (Using MSSqlserver 2000) EntryTime Speed Gross Net ------------------ ----- ----- 21:09:13.310 0 0 0 21:09:19.370 9000 NULL NULL 21:09:21.310 NULL 95 NULL 21:10:12.380 9000 NULL NULL 21:10:24.310 NULL 253 NULL
2
9474
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of the choice made in the first drop-down list? If so, how can that be done? I am working with 'Teach Yourself Microsoft Access' and I didn't see it discussed in that book (if it's even possible to do). Or would I just have to create linked tables...
7
1945
by: trint | last post by:
This: string strSQL2 = "INSERT INTO tblTravelDetailMember(memberId, " + " TravelDetailUplineId, " + " rankId, " + " TravelDetailId, " + " CreatedDateTime, " + " Operator) " + "VALUES ('" + insertString2 + "', " + " '" + insertString3 + "', " +
9
4039
by: Oberon | last post by:
My HashTable (Global.Games) is a static collection of objects of type Game. A Game object has 8 fields (exposed as properties). The key to the HashTable is also one of these fields (GameID, of type int). When I try to create a SortedList from the HashTable with the following: SortedList sortedGames = new SortedList(Global.Games); I get an error message:
2
1161
by: thomasp | last post by:
I am attempting to create a table in an Access database using VB2005 beta 2. I seem to be able to get it to work all except for adding a Boolean column. The following statement works if I remove the ""POI BOL, " & _" line from it. Will someone please tell me the snytax for adding a boolean column? Thanks, Thomas
4
8673
by: Arpan | last post by:
A SQL Server 2005 DB table has 4 columns namely "ID" (IDENTITY int column), "FirstName" (varchar(50)), "LastName" (varchar(50)) & "DOB" (datetime). Now when I am trying to add a new row using the following INSERT statement: sqlDapter.InsertCommand = New SqlCommand sqlDapter.InsertCommand.CommandText = "INSERT INTO UserDetailss VALUES('bobby','simpson','" & Now() & "')" sqlDapter.InsertCommand.Connection = sqlConn sqlDapter.Update(dSet,...
1
2250
by: mark4asp | last post by:
I have a table bound to a repeater. There is a DateTime column called EntryDate. When the EntryDate changes day I want to write the date out. I want to compare the value of an item from a table column with a public variable and then set the variable to the value of that item when the days change Can I access the value of EntryDate column? If so how? Clearly not by using Eval because that requires me to bind it so something which I...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10329
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10152
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8974
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.