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 > Data Access, Manipulation & Batch Languages > ANSI SQL > Changing number to date

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-05-03, 10:00
exdter exdter is offline
Registered User
 
Join Date: Aug 2003
Posts: 328
Changing number to date

I have a table in SQL Server that has a date field whose properties are 'number'. I want to export this data to a table in Oracle. I can't touch the Server table to alter it to be a date. Is there some way I can do this in the Oracle table? Example- SQL Server= 20030324 (March 24,2003). In Oracle I want it to read '24/03/2003', or some other date format.
Reply With Quote
  #2 (permalink)  
Old 11-05-03, 10:23
mkkmg mkkmg is offline
Registered User
 
Join Date: Oct 2003
Location: Dallas
Posts: 76
you could do it through sql like this

declare @d as int
set @d = 20031105
select cast(substring(cast(@d as varchar(8)),5,2)+ '/' +
substring(cast(@d as varchar(8)),7,2)+ '/' +
left(cast(@d as varchar(8)),4)as smalldatetime)
Reply With Quote
  #3 (permalink)  
Old 11-05-03, 10:27
exdter exdter is offline
Registered User
 
Join Date: Aug 2003
Posts: 328
Re: you could do it through sql like this

I need to update a whole column in an Oracle table. Thanks.
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