Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
What is the correct way of inserting a DATE in to a database?
Old 08-03-2006, 11:18 AM What is the correct way of inserting a DATE in to a database?
Super Talker

Posts: 140
Trades: 0
Code:
create table EMPLOYEE (
    FNAME varchar(20) NOT NULL,
    MINIT varchar(1) NOT NULL,
    LNAME varchar(20) NOT NULL,
    SSN varchar(9) primary key,    
    BDATE date NOT NULL,
    CITY varchar(15) NOT NULL,
    SEX varchar(1) NOT NULL,
    SALARY int NOT NULL, 
    SUPERSSN varchar(9),
    DNO varchar(1),
)

insert into EMPLOYEE values ('John','B','Smith','123456789',1965-09-01,'Houston','M',30000,'333444555','5');

When i try to execute the above code it says

Server: Msg 2715, Level 16, State 7, Line 4
Column or parameter #5: Cannot find data type date.

Please help me with this.

Thanks
__________________

Please login or register to view this content. Registration is FREE
nvidura is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-03-2006, 11:56 AM Re: What is the correct way of inserting a DATE in to a database?
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
You need to put your date in quotes when inserting. I'm assuming you're using the MySql database engine.
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 08-03-2006, 04:42 PM Re: What is the correct way of inserting a DATE in to a database?
Super Talker

Posts: 140
Trades: 0
Thanks
I've change the "date" datatype with "datetime"
it was a syntax error.
__________________

Please login or register to view this content. Registration is FREE
nvidura is offline
Reply With Quote
View Public Profile
 
Old 08-04-2006, 08:19 AM Re: What is the correct way of inserting a DATE in to a database?
saadatshah's Avatar
Extreme Talker

Posts: 215
Name: Syed Saadat Ali
Location: Lahore, Pakistan
Trades: 0
Always specify the DB or the Language in which you facing the problem.
__________________
- -- --- ---- ----- ------ ------- ---------------
If you have knowledge, let others light their candles in it.
saadatshah is offline
Reply With Quote
View Public Profile Visit saadatshah's homepage!
 
Reply     « Reply to What is the correct way of inserting a DATE in to a database?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12865 seconds with 12 queries