Reading SQL DateTime in Navision

mitrax
Member Posts: 3
Hi,
i have a problem reading SQL Datetime in Navision.
My task is to select from another database (non-navision) recordsets and overtake them some of them into a navision table.
This works fine for varchar fields.
But there are two Datetime fields in the table that can not transferred. I get the error message, that this data type is not supported by C/SIDE.
I tried to transform the datetime field with sql-function DATEPART into its elements, but i had no success. Even if i only try to get one element of the datetime (e.g. year: DATEPART(yyyy,[datetime]) i still get the error message mentioned above.
Has anyone ever imported Datetime fields in navision and can give me a hint?
Thanks
Michael
i have a problem reading SQL Datetime in Navision.
My task is to select from another database (non-navision) recordsets and overtake them some of them into a navision table.
This works fine for varchar fields.
But there are two Datetime fields in the table that can not transferred. I get the error message, that this data type is not supported by C/SIDE.
I tried to transform the datetime field with sql-function DATEPART into its elements, but i had no success. Even if i only try to get one element of the datetime (e.g. year: DATEPART(yyyy,[datetime]) i still get the error message mentioned above.
Has anyone ever imported Datetime fields in navision and can give me a hint?
Thanks
Michael
0
Comments
-
What version of NAV? Is it one of the older version that do not support DateTime as a datatype? If so, what are the field datatypes?
You may need to use CAST/CONVERT to translate DateTime into separate Date and Time fields.There are no bugs - only undocumented features.0 -
Oh sorry, i use version 5.0 SP1.
I paste some code where you can see what i do:gaRecordset := gaADOConnection.Execute('SELECT [CPF_CNPJ_EMIT],convert(varchar(10),datepart(yyyy,[DT_AUT_SEFAZ]) as ThisRow FROM [NF-e].[dbo].[VW_CSF_RESP_NF_ERP]'); WHILE NOT gaRecordset.EOF DO BEGIN gaFields := gaRecordset.Fields; field := gaFields.Item('ThisRow'); MESSAGE('%1', field.Value); END;
Here i should get the year of the datetime field, but i get always the error message, that i mentioned in my first post.
It might seem a litte bit long-winded, but i tried to make it as elementar as possible.
Greetz
Michael0 -
In your sql statement use CONVERT or cast and change it to string.
This should solve your problem. I had same issue with decimal datatype and I casted to float and it resolved the issue.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions