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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:42:20+00:00 2026-05-23T21:42:20+00:00

When I import the following lines from a datafile: DATAFILE1: 1,2,3,4,5,6.789 10,11,12,13,14,15.6789 into SQL

  • 0

When I import the following lines from a datafile:

DATAFILE1:

1,2,3,4,5,6.789
10,11,12,13,14,15.6789

into SQL Server 2008 R2, The data comes in as though it is interpreting the data as ascii values base 256 (ie. 12337 = (48 * 256) + 49 where ‘0’ = 48 and ‘1’ = 49)

FIELD1  FIELD2  FIELD3  FIELD4  FIELD5  FIELD6       FIELD7
49      50      51      52      53      0.00000000   NULL
12337   12593   12849   13105   13361   0.00000000   NULL

The command I’m using

bcp TABLE1 in DATAFILE.csv -S SERVER1 -d DB1 -U sa -f bcp.fmt

Everything returns successfully without errors, but when I look in the table, everythings all wrong. Here’s the bcp.fmt file (non-xml)

10.0
6
1       SQLINT              0       0       ","   1     FIELD1                  ""
2       SQLSMALLINT         0       0       ","   2     FIELD2                  ""
3       SQLBIGINT           0       0       ","   3     FIELD3                  ""
4       SQLBIGINT           0       0       ","   4     FIELD4                  ""
5       SQLBIGINT           0       0       ","   5     FIELD5                  ""
6       SQLDECIMAL          0       0       "\n"  6     FIELD6                  ""

The DDL for the table:

CREATE TABLE [dbo].[TABLE1](
    [FIELD1] [int] NOT NULL,
    [FIELD2] [smallint] NOT NULL,
    [FIELD3] [bigint] NOT NULL,
    [FIELD4] [bigint] NULL,
    [FIELD5] [bigint] NULL,
    [FIELD6] [decimal](18, 8) NOT NULL,
    [FIELD7] [decimal](18, 8) NULL
)
  • 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-23T21:42:21+00:00Added an answer on May 23, 2026 at 9:42 pm

    Finally found the answer here:
    http://www.codeproject.com/Messages/3531341/bcp-and-int-ASCII-code-conversion-modified.aspx

    The problem was in the bcp.fmt file. The data types should be specified. To quote one of the responses “Just mark the damn field as SQLCHAR, and let db do conversion and all good.”

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

Sidebar

Related Questions

My script contains the following two lines as import-statements: import os from os import
The output from the following: import feedparser d = feedparser.parse('http://www.netflix.com/NewWatchInstantlyRSS') d.entries[177].keys() is: ['summary_detail', 'links',
why do the following lines not work as I expect? import numpy as np
I have a very simple Java RMI Server that looks like the following: import
I have the following code import smtplib from email.mime.text import MIMEText smtpserver = 'smtp.gmail.com'
I have the following simple code: import urllib2 import sys sys.path.append('../BeautifulSoup/BeautifulSoup-3.1.0.1') from BeautifulSoup import
I have the following lines to render TeX annotations in my matplotlib plot: import
I'm trying to restore a database from an sql file through phpmyadmin import function.
I have the following sql query SELECT * FROM jos_jcalpro_events AS e LEFT JOIN
What does the last line mean in the following code? import pickle, urllib handle

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.