If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > Inserting date

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-15-03, 09:09
patels39 patels39 is offline
Registered User
 
Join Date: Mar 2003
Location: Manchester
Posts: 1
Inserting date

Hi,

I am trying to insert a date '15/03/2003 11:55:57' in to a datetime field but get an error can anyone help me. I know you have to convert it but don't know how??????


Siraj
Reply With Quote
  #2 (permalink)  
Old 03-15-03, 12:41
osy45 osy45 is offline
Registered User
 
Join Date: Nov 2002
Posts: 833
create table data_example (id int not null, dateval datetime not null)
go

insert into date_example (id, dateval)
values (1, "March 15, 2003 11:55AM" )

go
Reply With Quote
  #3 (permalink)  
Old 03-17-03, 08:58
fadace fadace is offline
Registered User
 
Join Date: Nov 2002
Location: Switzerland
Posts: 523
Wink

US convention !


1> insert into t values('2003/03/15 00:00:22')
2> go
(1 row affected)

1> insert into t values('03/15/2003 00:00:22')
2> go
(1 row affected)

1> insert into t values('15/03/2003 00:00:22')
2> go
Msg 247, Level 16, State 1:
Server 'ASE125', Line 1:
Arithmetic overflow during implicit conversion of VARCHAR value '15/03/2003 00:00:22' to a DATETIME field .
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On