473,379 Members | 1,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Skip rows where the first column with letter 'S' - BCP

Hi All,
I have this data file with fix length(see below). I am able to insert
it into the database using bcp, but now I want to skip (do not insert)
the row which start with letter 'S' into the database. Is there away to
do it? By the way I am using -F2 option to skip the first record.

Here is my data:
Record 1 04
XXX
2 13106900240120042003040045061 Testing N POLYDOROS TRUST
EEE
2 12621241640280041004040045633 What are they MARTIN &
XXXXX
S C1000003200400409850000059611000000500001000000001 9613000000576497500
S X1000003200000209850000059613000000000000000000001 9613000000573497000

Thanks for your help.

Ted Lee

Aug 9 '06 #1
1 2491
On 9 Aug 2006 08:16:02 -0700, nt******@yahoo.com wrote:
>I have this data file with fix length(see below). I am able to insert
it into the database using bcp, but now I want to skip (do not insert)
the row which start with letter 'S' into the database. Is there away to
do it? By the way I am using -F2 option to skip the first record.

Here is my data:
Record 1 04
XXX
2 13106900240120042003040045061 Testing N POLYDOROS TRUST
EEE
2 12621241640280041004040045633 What are they MARTIN &
XXXXX
S C1000003200400409850000059611000000500001000000001 9613000000576497500
S X1000003200000209850000059613000000000000000000001 9613000000573497000
1) Create a new table with the same structure as your existing one,
plus an extra column to store the first character (if needed).

2) Give the new table trigger logic on insert/update to copy its data
to the original table iff the first character is not 'S'.

3) Use bcp to insert into the new table.

Alternatively, strip out the S lines ahead of time, e.g. install
ActivePerl and then do

while (<>) {
print "$_" unless $_ =~ /^S/;
}
Aug 9 '06 #2

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

Similar topics

2
by: Alan Mailer | last post by:
Imagine I had a table called MyTable with the following values: Field1 Field2 ____ _____ A X AA R B X BB T Now, say I want to return only rows which match *BOTH* of the
4
by: hharry | last post by:
Hello All, Does the BCP utility enable you to selectively import rows from a flat file to a table ? For example: The first column in my flat file contains a record type - 1, 2..7 I only...
59
by: AK | last post by:
I tried to google "skip scan DB2" but came up with nothing. Does DB2 have the feature under a different name?
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
16
by: Adam Witney | last post by:
Hi, Is it possible for the COPY command to read data from a file, but skip specific columns? Thanks Adam
3
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some...
5
by: bruxerjk | last post by:
I need to do the following. I want to copy cells from a number of Excel files, say "1.xls", "2.xls", "3.xls", etc, into successive rows of "All.xls". That is, I'd open "1.xls", copy cells and...
5
by: Jim in Arizona | last post by:
I built a webpage using vb.net (.net 2.0) that creates a form letter. This letter pulls data from a database. Although I populate the address with the person's full name, which comes from the name...
3
by: nigelesquire | last post by:
Please help! I'm trying to clone and delete multiple rows with JavaScript. I need two delete buttons that work...! I only have one for now, but it's not working properly, the output count is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.