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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:41:05+00:00 2026-05-17T15:41:05+00:00

How do you specify field lengths with the Bulk Insert command? Example: If I

  • 0

How do you specify field lengths with the Bulk Insert command?

Example: If I had a table named c:\Temp\TableA.txt and it had:

123ABC
456DEF

And I had a table such as:

use tempdb
CREATE TABLE TABLEA(
Field1 char(3),
Field2 char(3)
)
BULK INSERT TableA FROM 'C:\Temp\TableA.txt'
SELECT * FROM TableA

Then how would I specify the lengths for Field1 and Field2?

  • 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-05-17T15:41:06+00:00Added an answer on May 17, 2026 at 3:41 pm

    I think you need to define a format file

    e.g.

    BULK INSERT TableA FROM 'C:\Temp\TableA.txt'
    WITH (FORMATFILE = 'C:\Temp\Format.xml')
    SELECT * FROM TableA
    

    For that to work, though, you need a Format File, obviously.

    See here for general info about creating one:

    Creating a Format File

    At a guess, from looking at the Schema, something like this might do it:

    <?xml version="1.0"?>
    <BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <RECORD>
      <FIELD ID="1" xsi:type="CharFixed" LENGTH="3"/>
      <FIELD ID="2" xsi:type="CharFixed" LENGTH="3"/>
    </RECORD>
    <ROW>
      <COLUMN SOURCE="1" NAME="Field1" xsi:type="SQLCHAR" LENGTH="3"/>
      <COLUMN SOURCE="2" NAME="Field2" xsi:type="SQLCHAR" LENGTH="3"/>
    </ROW>
    </BCPFORMAT>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know of two ways to specify a field in a record set with
I'm displaying a table with multiple rows and columns. I'm using a JQUERY plugin
I am assuming I need a regular expression here? I have a zip code
I am attempting to add validation to my application. I have some rules I
I need to create a user control with form fields for Country (dropdown), Address
I am new to AES encryption but trying to build a solution which: Accepts
In a related question I asked about binding to a particular element of an
This is part of my model: @Entity public class Entry { @Id @GeneratedValue private
I have a directory full of files containing records like: FAKE ORGANIZATION 799 S

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.