473,657 Members | 2,851 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rows not importing through BCP

Hello,

I am importing a file using BCP, with a format file. It is a
fixed-width file, which I am importing into a table that has a column
for each field in the file. The columns in my import table are all
defined as CHAR. I use it as a staging area to check the data (are
dates formatted correctly, etc.) before moving it from there.

In one of my files I have six records that contain strange characters
(ascii codes of 03 and 02 if I am remembering correctly). When I
import the file, these six records do not get imported. Not only that,
but if I use the error file option with BCP, nothing is put in the
error file either. As far as I can tell, it is just skipping right
over the rows. If I import the file into a table with a single column
that holds the entire row of data, all rows get imported.

I've included a sample of the format file below (there are 106 fields
in the real one, so I've abbreviated it for space). I've also included
a table definition as well.

Has anyone seen this behavior before? Any ideas?

Thanks and Happy New Year!
-Tom.
Table Definition:
-----------------------------------------------------------
CREATE TABLE [dbo].[BIF_Pre_Staging] (
[dda_num] [char] (18) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NULL ,
[account_app_id] [char] (4) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NULL
,
[cust_num] [char] (10) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NULL ,
[CUST_ACT_OWNER_ TYPE] [char] (1) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS
NULL ,
[do_not_mail] [char] (6) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NULL ,
[employee_code] [char] (1) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NULL
,
[ACCOUNT_TAX_NUM] [char] (9) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS
NULL ,
[CUS_PFS_FLAG] [char] (1) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NULL ,
[SUB_TIER_VALUE] [char] (5) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NULL
) ON [PRIMARY]
GO

-----------------------------------------------------------
Sample Format File:
-----------------------------------------------------------
8.0
9
1 SQLCHAR 0 18 "" 1 dda_num ""
2 SQLCHAR 0 4 "" 2 account_app_id ""
3 SQLCHAR 0 10 "" 3 cust_num ""
4 SQLCHAR 0 1 "" 4 CUST_ACT_OWNER_ TYPE ""
5 SQLCHAR 0 6 "" 5 do_not_mail ""
6 SQLCHAR 0 1 "" 6 employee_code ""
7 SQLCHAR 0 9 "" 7 ACCOUNT_TAX_NUM ""
8 SQLCHAR 0 1 "" 8 CUS_PFS_FLAG ""
9 SQLCHAR 0 5 "\r\n" 9 SUB_TIER_VALUE ""
-----------------------------------------------------------
Jul 20 '05 #1
1 4583
Thomas R. Hummel (to********@hot mail.com) writes:
In one of my files I have six records that contain strange characters
(ascii codes of 03 and 02 if I am remembering correctly). When I
import the file, these six records do not get imported. Not only that,
but if I use the error file option with BCP, nothing is put in the
error file either. As far as I can tell, it is just skipping right
over the rows. If I import the file into a table with a single column
that holds the entire row of data, all rows get imported.

I've included a sample of the format file below (there are 106 fields
in the real one, so I've abbreviated it for space). I've also included
a table definition as well.


I tried your table and format file, with this data:

123456789012345 678ABCD12345678 90|abcdefX12345 6789/12345
%%%456789012345 678ABCD12345678 90@abcdefX12345 6789/12345
¤¤¤456789012345 678ABCD12345678 90\abcdefX12345 6789/12345
"""456789012345 678ABCD12345678 90?abcdefX12345 6789/12345

This loaded fine. I then replaced the "d" on the last two lines with
ASCII 2 & 3. The file still loaded fine.

Could you try to achieve a complete repro?
--
Erland Sommarskog, SQL Server MVP, so****@algonet. se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2330
by: TonyB | last post by:
Hi, I've searched the group and need more information and guidance on this issue I need to resolve next week. I work for the local school system and I am working on a way to parse a CSV file of class lists from MS Excel. It is a ~2MB file with all teachers and all their classes in it. I thought I would use Python to do this since many people I know tell me how great it is. The real sticking point is there are duplicates of each...
3
3664
by: Elaksomfan | last post by:
Hi, I am having trouble importing data from an excel spreadsheet into MS SQL Server 2000 using DTS Wizard. The DTS import process is successfull, no errors, but only 50 rows of approx. 1500 rows of data are imported. I tried to remove 20 rows in the excel spreadsheet in the interval row 0-50. When i later ran the import, only 30 rows were imported. I deleted almost every row in the interval 0-50, with the result of the import having 0...
3
11518
by: Stephen Matthews | last post by:
Help please i have a file which im importing, however it is a single column, the data looks like C8517673505 N7062175 C8517673516 N7062178 C8517673527
4
1966
by: R Bolling | last post by:
I have a text file from a text document that has very long rows (two or three paragraphs from a text document for each row). Importing to text cuts it off at 255 characters, and importing to a memo still cuts it short. TransferText cut it short too. Someone suggested that I use the following code. It works, but it populates only one row of the text. Missing something critical. Any ideas on how to get this to work? 'Beginning of...
0
1126
by: Andy | last post by:
Hello All: I am importing an Excel / CSV file. The problem I am having is: the columns are being defined for me as int32 (able to determine by using the ..GetFieldType method). As a result: when a row has a character, we are losing this data, because it is being interprested as "". How would I go about making the columns always text? Below is my code that I am using: System.Data.OleDb.OleDbConnection con = new...
10
2029
by: el__marcin | last post by:
hi I am using MS office Access 2003. ANybody knows how to convert more than 300-400K rows from text into e.g. number ? I tried to do so a few times and access told me there aint enough memory or something. Anybody knows quick fix to that problem ? thanks
1
1289
by: ozzii | last post by:
Is there any way to retrieve the ids of all rows inserted after importing bulk data using the load infile technique? I need the ids of all rows that have been inserted so that they can be inserted in to another table as foriegn keys.
4
20385
by: sudhaMurugesan | last post by:
Hi all, I am importing data from excel sheet. i get the data in a datatable. when there are empty rows in excel i am getting empty rows in datatable also. how to remove empty rows? help me please. Thanks & Regards
4
5890
by: kageyone | last post by:
I have an access database with a table with two fields. They are 1. a GUID field and 2. a comma delimited set of values. I want to take this table and for each row I want to do the following: copy the GUID to a new rows field 1 parse out the first value of the csv field and copy to a new rows field 2 Continue to write new rows with the GUID and the next value in the csv field until all values have been written to new rows in a new...
0
8385
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8502
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8602
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.