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 > Pervasive.SQL > Convert DateTime problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-24-11, 19:59
pla80 pla80 is offline
Registered User
 
Join Date: Aug 2011
Posts: 1
Convert DateTime problem

Version: Pervasive 10.30

Problem: I need to change DateTime column values from mm/dd/yyyy into dd/mm/yyyy

update with set=2011/01/01 is working good

1 step was to create 2nd table and copy all data, in 2nd step i want to convert exisiting date format into new one. I am using this statment i found somewhere in this forum:

update test
set data= select convert(day(datac),SQL_CHAR) + '/' + convert(month(datac),SQL_CHAR) + '/' + convert

(year(datac),SQL_CHAR) from Table where id=1
where test.id=2


Error:[LNA][Pervasive][ODBC Engine Interface]Invalid date, time or timestamp value.

Can someone point me where i made errors?
Reply With Quote
  #2 (permalink)  
Old 08-25-11, 00:18
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
Is the data type in the table actually a Date or DateTime? If it is, the format will have to be 'yyyy-mm-dd'. You cannot store it in the field any other way.

What exactly are you trying to accomplish with the conversion?
__________________
Mirtheil Software
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On