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 8985173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:16:25+00:00 2026-06-15T21:16:25+00:00

I have experience using XML format files created with BCP command line and then

  • 0

I have experience using XML format files created with BCP command line and then using that for bulk files with only one record format.

My question is, is there a way to insert a conditional statement within the XML to handle different records within the same data file i.e.:

data1 data2 data 3

data4 data5 data6 data7 data8

etc etc…

I’ve looked through the schema for the XML and I’m coming to the conclusion that this is not what the bulk upload format file was designed for.

Thanks in advance!

  • 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-15T21:16:26+00:00Added an answer on June 15, 2026 at 9:16 pm

    To the best of my knowledge, there is no provided SQL Server import method (Bulk Insert, BCP, SSIS, etc.) that supports variable column sets. Every column defined absolutely must be in every import row.

    For this reason, the preferred means of handling this (very common) situation is either of the following:

    1) Use (or write) a specialized import program written in a general purpose language (VB, C#, etc.) to parse the text file and then insert it into your SQL Server’s table(s). Or,

    2) Use one of SQL Server’s provided Import methods (Bulk Insert, BCP, SSIS, etc.) to import each row as a single text column (as NVarchar(MAX)) into a staging table and then use SQL to parse these text rows into their actual columns. (This is my preferred method)

    A typical Staging Table for (2) above would look like this:

    CREATE TABLE Import_Staging
    (
        RowNumber INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
        RowText   NVARCHAR(MAX)
    );
    

    If you do go this route, the import tools are generally happier if you hide the IDENTITY column from them, which can easily be done by creating a facade View and then directing the Import to the View instead of the Table. Like so:

    CREATE VIEW vImport_Staging AS SELECT RowText FROM Import_Staging;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a task at work that involves converting legacy SGM files into XML.
I am working on a system that will have several hundred thousand XML files,
I have an xml document that I am creating using the loop below and
I have a WCF application that at present is using XML based file storage
I work with a datamodel created using JAXB, from that I can generate XML
I have some experience using parallel extensions in .Net development, but I was looking
Does anyone have any experience using PHP to send an sms via skype I
I'm new to grails, but have previous experience using .net with c# and linq
I have very little experience using Sharepoint but a good amount using Visual Studio
I have experience developing in android and using REST services, but now I'd like

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.