TSQL Convert SQL smalldatetime to string for MS Access Date/Time

Hi All,

I have a stored procedure which collects a recordset which populates and array. This array array in turns loops and populates an MS Access 2007 Database table.

Everything goes well right up to 'Report_DC' (Date Created). This either copies poorly or not at all. There are no NULL's all the reports have a value for this field which look like this: 2012-11-02 17:38:00

I have tries

,  CAST (rpt.Report_DC as varchar)

but it does not work. When I open the Access table I get 'XXXXXXXXXXXX'

Any ideas.

Kind regards

Abiel M de Groot Sanders
Abiel de GrootDeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
Convert ( VARCHAR(10), report_dc ,120)

See also my article

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
In the receiving table in Access, what is the Data type of the field receiving the data from "Report_DC"?

When I open the Access table I get 'XXXXXXXXXXXX'
So you are getting data into the field, but it's not what you expect? You're getting the XXXXXXXXXX string instead?
Abiel de GrootDeveloperAuthor Commented:
In the meantime I overlooked the fact there were some local solutions too. As I am using ASP I was simply able to use FormatDateTime(ArrReports(3,ki),2) to parse the string.

Kind regards

Abiel M de Groot Sanders
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.