Solved

converting a date that is in INT format in SQL to standard date format xx/xx/xxxx

Posted on 2004-10-12
7
1,243 Views
Last Modified: 2008-02-01
I have a SQL server DB on the backend and a program that uses it written in Clarion 5 on the front end. Problem is Clarion is writing dates and times as date type INT (length 4) and I am now using MS Access 2003 for reports and some queries and I don't know where and how to convert the data. For example, the data is as follows: date format= 74300, and the time format= 3578973. The programmer I used suggested the following code: CAST(PMT_DATE - 36163 AS datetime). Problem is, I have no clue where to put it or how to execute the code. Any help?
0
Comment
Question by:buzcut
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 10

Accepted Solution

by:
Jay Toops earned 500 total points
ID: 12288388
the easiest way would be to create a view on SQL server
a view is just an alternate way of looking at data from a sql server table
then in access simply point your query to this view instead of the main table.

CREATE view MyDateView as
select CAST(PMT_DATE - 36163 AS datetime) as PMT_DATE, field2, field3
FROM MYTABLE

Jay
0
 
LVL 6

Expert Comment

by:RaisinJ
ID: 12289464
Is your program in Clarion just writing to the DB or also reading data?
0
 

Author Comment

by:buzcut
ID: 12290660
the front end is written in Clarion and it reads and writes data to the SQL Server tables.
0
Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 
LVL 10

Expert Comment

by:Jay Toops
ID: 12290994
buzcut... have you tried the view method?

Jay
0
 

Author Comment

by:buzcut
ID: 12291088
Jay-

your instructions worked great! I can see the regular date now... but the other part of this question was how do I create a new table based on the new view? See, I want to have the table store the date as datetime and not as an INT so I can continue to work with the DB from Access, since I am replacing the Clarion front end. Thanks again!!!

Ed
0
 

Author Comment

by:buzcut
ID: 12291383
Jay-

I just figured out how to create a table with the new definitions and converted data. Again, thank you for all of your help!!!

Ed
0
 
LVL 10

Expert Comment

by:Jay Toops
ID: 12291449
Cool

Enjoy :)
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how the fundamental information of how to create a table.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question