Dynamic data import / export


simply more productive
Up to 100,000 records can be processed with the freeware version!
Welcome, Guest
Username: Password: Remember me
Welcome to the FlowHeater support forum.

Questions about using FlowHeater are answered here.
  • Page:
  • 1

TOPIC: Excel Date Problem Causes FH End Job

Excel Date Problem Causes FH End Job 5 years 11 months ago #2173

  • David Campbell
  • David Campbell's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
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?


Please Log in or Create an account to join the conversation.

Re:Excel Date Problem Causes FH End Job 5 years 11 months ago #2174

  • FlowHeater-Team
  • FlowHeater-Team's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 274
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.
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.

Please Log in or Create an account to join the conversation.

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.
  • Page:
  • 1
Moderators: FlowHeater-Team
Time to create page: 0.078 seconds