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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:01:24+00:00 2026-05-13T22:01:24+00:00

I have a text file (txt) containing formatted text (just line breaks, carriage returns

  • 0

I have a text file (txt) containing formatted text (just line breaks, carriage returns and tabs)
It also contains German language characters.

I want to use the Bulk Insert comment in T-SQL to read in the text file into one field within a database table.

I ran this command:

 CREATE TABLE #MyTestTable (
    MyData NVARCHAR(MAX)
 )

 BULK INSERT [#MyTestTable]
FROM 'D:\MyTextFile.txt'

 SELECT * FROM #MyTestTable

The problem is that it reads each line of the text file into a new row in the Temp table. I want it to read the whole file (formatting and all) into one row.

Also the German language characters appear to be lost – replaced by a non-printable character default in the Results View.

Anyone any ideas how I can achieve this?

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-05-13T22:01:25+00:00Added an answer on May 13, 2026 at 10:01 pm

    You can use ROWTERMINATOR and CODEPAGE parameters. Default row terminator is ‘\r\n’. For the CODEPAGE, you need to know encoding of your raw file and default collation of your DB.

    BULK INSERT [#MyTestTable]
    FROM 'D:\MyTextFile.txt'
    WITH (ROWTERMINATOR = '\0',
          CODEPAGE = 'ACP')
    

    Also see http://msdn.microsoft.com/en-us/library/ms188365.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text file named num.txt who's only contents is the line 123
I have a TXT file containing about 10,000 lines of text. I want to
I have text file, names.txt, with every row containing a last name: Smith Johnson
we have a text file containing binary values. say, we have a file file.txt,it
Considering i have a 100GB txt file containing millions of lines of text. How
I have 1 text file containing Ips .Like this iptextfile.txt 10.0.0.1 192.168.1.1 123.123.123.123 And
Ok, I have a text file containing an encrypted string of text called textToDecrypt.txt
I have a .txt text file, containing some lines.. I load the contain using
I have a text file stored in my sql DB. in that .txt file
I have a text file in the root of my web app http://localhost/foo.txt and

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.