Skip to main content
simply more productive

The Data Specialist

Thanks to our intuitive transformation designer, you can convert data effortlessly to a variety of formats without knowing how to program. It’s not only efficient, it’s also easy to use.
Flowheater Download

Excel Date Problem Causes FH End Job

  • David Campbell
  • Topic Author
  • Offline
  • User
  • User
More
12 years 5 months ago #2173 by David Campbell
Excel Date Problem Causes FH End Job was created by David Campbell
Hi I have an excel file I'm moving to SQL server.
The date of Birth field was 6/15/200

47 Fred Smith Kathleen 6/15/200
This bad date ends job when it tries to write to SQL server - Can you tell me how to prevent these kinds of problems - with dates?

thanks
David
:)

Please Log in to join the conversation.

More
12 years 5 months ago #2174 by FlowHeater-Team
Replied by FlowHeater-Team on topic Re:Excel Date Problem Causes FH End Job
Hi David,

I guess this error occurs because the certain SQL Server date/time field has a not null constraint!

In this case you can use the .NET Script Heater and the script below to check the Excel date value. If your excel date value isn’t a Date/Time value the script returns a standard value to insert in the database table.
Code:
public object DoWork() { // here you can modify the default (date) value string defaultvalue = "01/01/1899"; if (InValues.Length != 1) throw new Exception("one input paramater expected!"); object o = InValues[0].GetDateTime(); if (o == null) { // if the Input parameter isn't a DateTime return the default value return defaultvalue; } // return the first input parameter return InValues[0].GetValue(); }

To use this script you have to move (Drag&Drop) one .NET Script Heater in the connection of the Excel date field and the SQL Server date field. Double click on the heater, copy the script above into the Heater and modify the default value. This value inserted into the SQL Server database in case of the Excel date can’t converted into a proper Date/Time value.

Best wishes
Robert Stark

Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.

Please Log in to join the conversation.

Time to create page: 0.255 seconds

FlowHeater - The Data Specialist

Efficient data integration and transformation with FlowHeater – the perfect solution for a seamless transfer of your data.

Rechtliches

Support & Contact

Kontaktinformation

Telefon:0951 / 99339792 E-Mail:This email address is being protected from spambots. You need JavaScript enabled to view it.

Copyright © 2009-2024 by FlowHeater GmbH. All rights reserved.