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

  • Home
  • SEARCH
  • 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 7723647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:29:39+00:00 2026-06-01T04:29:39+00:00

I have a 3rd party app that does a database export in to a

  • 0

I have a 3rd party app that does a database export in to a “SQL format” it is fairly straitforward however it appears to not use T-SQL exactly. When I export it produce something like this

INSERT INTO [ExampleDB] ( [IntField] , [DateTimeField] , [VarcharField], [BinaryField])
VALUES
(1 , '2012/04/02 12:25:00:01' , 'Some Text' , X'123456'),
(2 , '0000/00/00 00:00:00:00' , 'B' , NULL),
--(SNIP, it does this for 1000 records)
(999,'0000/00/00 00:00:00:00' , 'Other Text' , null);
(1000 ,'0000/00/00 00:00:00:00' , 'D' , null);

INSERT INTO [ExampleDB] ( [IntField] , [DateTimeField] , [VarcharField] , BinaryField)
VALUES
(1001 , '2012/04/02 12:25:00:01' , 'Trying to break my parser with the next line', null),
(1002 , '0000/00/00 00:00:00:00' , ' ''X''123' , X'deadbeef'),
(1003 , '0000/00/00 00:00:00:00' , 'Did it break it?' , null),
(1004 , '2012/04/02 12:25:00:01' , 'What about this? ''0000/00/00 00:00:00:00'' Will that?' , null),
--(SNIP)

The two snags I am running in to are:

  • the value of '0000/00/00 00:00:00:00' for a date
  • the fact that they store binary output as a string prefixed by X

I am thinking I can just do a Regex.Replace on it, but I am wondering if there is a easier solution. So far my code to import is

using (var cmd = new SqlCommand("", conn))
{
    //snip
    cmd.CommandTimeout = 0; //Wait forever, bad bad bad, but what else can I do?
    using (var txtRdr = new StreamReader(file))
    {
        string query = txtRdr.ReadToEnd();
        query = query.Replace(" '0000/00/00 00:00:00:00' ", " NULL ");
        query = Regex.Replace(query, "X'([0-9a-fA-F]+)'", @"0x$1");
        cmd.CommandText = query;
        cmd.ExecuteNonQuery();

    }
}

Because the way they list values I know I am tied to SQL2008 or newer but are there any gotchas to the code I wrote to make it parse-able by SQL2008?

When I run it it gets bogged down on the Execute query. The SQL files are 8000 KB in size (but I can adjust it) is there anything I can do to speed it up? Perhaps do some more formatting and turn it in to a bulk insert?

  • 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-01T04:29:41+00:00Added an answer on June 1, 2026 at 4:29 am

    Whenever I have had to transfer data between two databases I have found that the quickest way seems to be as follows:

    1. Use the unload or equivalent feature to bulk export the source database to a text file.
    2. Write software that converts the text file format from the source format to the destination format.
    3. Use the bulk import or similar feature to load the text file into the destination database.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a 3rd-party app that wants to call a stored proc using SQL
I have a Winform App that uses a 3rd Party Library of Controls, DevExpress.
I have a 3rd party app that is generating an executable for me, but
I have a standalone (3rd party) app that I'm trying to launch using a
I have a .Net4 WinForms app that references 3rd party .Net2 assemblies, which contain
I have a managed class library (say mylib.dll) and a 3rd party managed app
I have a 3rd Party tool that generates an xml spreadsheet (*.xls). I have
I have a 3rd party JAR that I have converted to an OSGI bundle
I have a 3rd party struct that is comprised of the following: [StructLayout(LayoutKind.Sequential, Size=1)]
so I have a 3rd party application that I have to interface with, this

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.