473,386 Members | 1,621 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,386 software developers and data experts.

MSSQL2000: PIPE Delimited Issue

benchpolo
142 100+
Data Row 1 -> AAA|123|ABCDE|929292||183 EAST WAY #A11|223|TX|CA|12
Data Row 2 -> BBB|123|ABCDE|||183 EAST WAY #A11|223|TX|CA|12
Data Row 3 -> VVV||ABCDE|929292||183 EAST WAY #A11|223|TX|CA|12
Data Row 4 -> AAA|123|ABCDE|929292||183 EAST WAY #A11|223|TX|CA|12
Data Row 5 -> WWW|123|ABCDE|929292|QA|183 EAST WAY #A11
|223|TX|CA|12

Data Row 6 -> AAA|123|ABCDE|929292||183 EAST WAY #A11|223||CA|12
Data Row 7 -> KKK|123|ABCDE|929292||183 EAST WAY #A11|223||CA|12

As illustrated above, I have 7 data row with 10 data columns using PIPE Delimited to extract data in MSSQL 2000 DTS Process using FILE TYPE: ANSI, Row Delimiter: {CR}{LF}, Column Delimiter: Vertical Bar and Text Qualifier: <none>

ISSUE: I cannot figure out why Data Row 5 text file has a second line compare to the other data row, which is 1 line of data. I re-run the DTS process over and over again, but i am getting the same result on selected data rows only. Please help. Thanks.
Oct 11 '07 #1
8 2311
iburyak
1,017 Expert 512MB
Data Row 1 -> AAA|123|ABCDE|929292||183 EAST WAY #A11|223|TX|CA|12
Data Row 2 -> BBB|123|ABCDE|||183 EAST WAY #A11|223|TX|CA|12
Data Row 3 -> VVV||ABCDE|929292||183 EAST WAY #A11|223|TX|CA|12
Data Row 4 -> AAA|123|ABCDE|929292||183 EAST WAY #A11|223|TX|CA|12
Data Row 5 -> WWW|123|ABCDE|929292|QA|183 EAST WAY #A11
|223|TX|CA|12

Data Row 6 -> AAA|123|ABCDE|929292||183 EAST WAY #A11|223||CA|12
Data Row 7 -> KKK|123|ABCDE|929292||183 EAST WAY #A11|223||CA|12

As illustrated above, I have 7 data row with 10 data columns using PIPE Delimited to extract data in MSSQL 2000 DTS Process using FILE TYPE: ANSI, Row Delimiter: {CR}{LF}, Column Delimiter: Vertical Bar and Text Qualifier: <none>

ISSUE: I cannot figure out why Data Row 5 text file has a second line compare to the other data row, which is 1 line of data. I re-run the DTS process over and over again, but i am getting the same result on selected data rows only. Please help. Thanks.
Try this exercise on your table:
Expand|Select|Wrap|Line Numbers
  1. select * from table_name where charindex(char(10), problem_column) > 0 or charindex(char(13), problem_column) > 0
Sometimes when user enters data manually he hits Enter key at the end. You can’t see it visually in a database column but it is the same as {CR}{LF} and it could be a reason you get a broken line.
To overcome this problem, find problem values and do update on them to the same but without this last 2 characters.
Good Luck.
Oct 11 '07 #2
benchpolo
142 100+
I was able to write RTRIM(<column>), and the {CR}{LF} was removed, but what if there's 2 || (pipe) at the end of the data? Somehow, the RTRIM doesn't apply? Please advise. Thakns.
Oct 12 '07 #3
iburyak
1,017 Expert 512MB
So I was right about broken line…. :)
I assume || happens when you have null in column in the middle and it is just a place holder for a column position.
Check your data and make sure it is the case.


Good Luck.
Oct 12 '07 #4
benchpolo
142 100+
Actually, I checked the data in the user screen, and indeed the user entered the information with additional double '||' in the end. I tried the RTRIM, it works on single pipe, but not on double pipe, the row is still split into two, i'm having the user correct the data in their system. Thanks.
Oct 12 '07 #5
benchpolo
142 100+
So, if i have a data row for example address like the one below, how would I eliminate the double pipe to a sql script.

Data: 999 Xavier Avenue #123||

This is not 2 columns it's one column the user added two carriage return in the GUI. Thanks.
Oct 12 '07 #6
iburyak
1,017 Expert 512MB
Is it a double-pipe or a place holder for carriage return?


If it is just a double-pipe do following :

Expand|Select|Wrap|Line Numbers
  1. select replace('999 Xavier Avenue #123||', '||','')
Good Luck.
Oct 12 '07 #7
benchpolo
142 100+
how would you handle if you have multiple data row having one column with i.e. 1 pipe and the other data 2 pipe.

Example:

Data 1: 123 Westhills Ave #1|
Data 2: 144 Somers Drive #222||

I wrote the following script below to handle this, but not sure if this will take care of the double pipe in a column.

LTRIM(RTRIM(REPLACE(mc.street,'|',''))) as 'address'

Thanks.
Oct 12 '07 #8
iburyak
1,017 Expert 512MB
Sure it will take care of single or double-pipe.


Try this to test:
Expand|Select|Wrap|Line Numbers
  1. select LTRIM(RTRIM(REPLACE('Data 2: 144 Somers Drive #222||','|',''))) as 'address'

Good Luck.
Oct 12 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ray Stevens | last post by:
I am loading a pipe-delimited string from a DataSet into StringBuilder, such as 00P|23423||98723 (etc.). For some reason the pipe character is displaying in the debugger as "o" with two small dots...
0
by: Masa Ito | last post by:
I have pipe delimited (and comma/tab) files that I read with JET using a schema file. Occasionally a field has multiple quotes (") inside a single field - which chokes the line (the rest of the...
0
by: Marek Wierzbicki | last post by:
Drodzy czytelnicy listy Szukam specjalisty znaj±cego się perfekcyjne na MSSQL2000. Interesuje mnie wiedza typu "inside", czyli struktury plików itp. Konkretnie chodzi mi o organizacje wewnętrzn±...
1
by: bhups | last post by:
hi, i am doing a lookup using hash table. I have a pipe delimited file that i have to search for a new invocie number field by checking of an old invoice number-customer number key combination...
1
by: Fordraiders | last post by:
vb.net 2003 Office 2003 What I have: C:\TestData\Input.txt Text File Pipe Delimited : 4 columns Of data example: 00001|NO BRAND NAME ASSIGNED|6DU27|M3-.5 X 6 FLAT HD SOCKET CAP SCREW,...
2
by: mike_dba | last post by:
I am attempting to move data between 2 DB2 Linux databases using a pipe. I can't seem to get it working. Any assistance is appreciated. I first issue: mkfifo -m777 mypipe db2 "connect to...
3
by: Erwin Moller | last post by:
Hi Group, I developed a intranet site using MSSQL7/win2000 some time ago. The target environment used MSSQL2000/8. We were (almost painlessly) able to import the db-scheme and data from 7 to 8....
1
by: bhapate1 | last post by:
Hi all, I Have a Table with 10 Columns, Among those i have Data in just 3 Columns. Rest of columns wil be blank. I want to Export that Table as a Pipe Delimited Text File. I am using...
1
by: chiku1523 | last post by:
Hi All, In file1.txt I have following data. 1B13C1311945038FE0440003BA1DC817-PLC13|1B13C1311945038FE0440003BA1DC817-PLC130.18063115540216856...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.