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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:20:59+00:00 2026-06-15T10:20:59+00:00

How to I trim empty space when doing bulk insert? I have the sample

  • 0

How to I trim empty space when doing bulk insert? I have the sample data as below:

| |100  |4000009|1000 |01    |                                   |201004471|          |28.01.1972|10.04.2012|300485|ABC 307.07B            |01   |                         |          |SSC |SSC  |CA02      |00   |      |0       |SESC    |COM  |01      |01   |00.00.0000|00.00.0000|FR1  |
  • 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-15T10:20:59+00:00Added an answer on June 15, 2026 at 10:20 am

    It may not be the most elegant solution, but you could bulk insert into a temporary table and then insert trimmed data from temp table into target table.

    CREATE TABLE #temp
    (
        [field1] [varchar](20) NOT NULL,
        [field2] [varchar](100) NOT NULL
    ) 
    
    BULK
    INSERT #temp
    FROM 'C:\Temp\data.txt' 
    WITH
    (
    FIELDTERMINATOR = '|',
    ROWTERMINATOR = '\n',
    FIRSTROW = 1
    )
    GO
    
    Insert Into MyDatabase..TargetTable ([field1], [field2])
    Select RTRIM(LTRIM([field1])), RTRIM(LTRIM([field2])) From #temp
    
    Drop table #temp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to trim a PHP array and remove all empty indexes Array ( [0]
I need to get a trimmed CGImage. I have an image which has empty
i have a data validation class method where i check the user input before
Suppose I have the HTML code as below <table width=600 border=0 cellpadding=0 cellspacing=0 align=center
I have few tables having more than 20 columns and I have to Trim
I'm trying to use $.trim() to trim whitespace in empty elements so I can
I have a method like this: public string StartCapture(string[] args) { if(args[0].Trim() == null
I need to trim all the trailing white spaces from the text elements of
How can we trim a StringBuilder value without the overhead caused by using StringBuilder.toString().trim()
I am trying to trim this, which is stored in a variable called $line.

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.