Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7802917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:24:12+00:00 2026-06-02T01:24:12+00:00

I am importing a file into SQL Server using BCP utility in Perl program.

  • 0

I am importing a file into SQL Server using BCP utility in Perl program.
In the file which I am importing, there is a wrong date format so the Import process fails with following error:

SQLState = 22008, NativeError = 0
Error = [Microsoft][SQL Server Native Client 10.0]Invalid date format

I am executing the bcp command as follows in my perl program.

my $myBcp = "bcp.exe" <table name> in <temp file path> -f<format file> -m 1 -h "FIRE_TRIGGERS" -o<log file path>
my $myResult = system($myBcp);

When I print $myResult it gives me ‘0’. Since there is an “Invalid date format” error, it should return me a error code.

Can anyone let me know how to catch Invalid Date Format error in my perl program?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:24:14+00:00Added an answer on June 2, 2026 at 1:24 am

    You should redirect STDERR to STDOUT by 2>&1 as follows:

    my $myBcp = '"bcp.exe" <table name> in <temp file path> -f<format file> -m 1 -h "FIRE_TRIGGERS" -o<log file path>';
    my $myResult = `$myBcp 2>&1`;
    print $myResult;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an SQL-File which i need to modify before importing it into the
I am using openrowset to import a csv file into SQL Server. One of
I am importing approx 350,000 lines from a CSV file into MySQL using PHP
In my iPhone app, I am importing CSV file into SQlite database using CHCSV
I'm using MySQL workbench to import a Joomla sample_data.sql file into my local database.
I am importing data into a sql table from a csv using an xml
I'm trying to upload Excel (2003) file into Sql server 2005. At present we
I'm importing an Excel file (about 1000 records only) to a dedicated SQL Server
According to convention, I'm importing an initializing JavaScript file into my jQuery Mobile pages
I am importing a very large file (2-3 GB of text) into a collection,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.