Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Schema

Status
Not open for further replies.

mayu03

Programmer
Oct 3, 2003
91
US
I have data in a file where lines end indicator is'~'
Can you help me create schema for the following data.
The actual data is after the second star in line.
ST*278*0001~
BHT*0078*13*A990145*20010912*1010~
HL*1**20*1~
 
What you have is a flat file, not an XML file.

Designing a schema involves deciding on the names of fields, their position in a hierarchy, and the datatypes & lengths of the field values.

It looks like in your example that the number of fields depends on the value of the first bit -- "ST" has two fields, "BHT" has five, and "HL" has four, where one is optional.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Maybe we should start by asking what you must do with this file. And can we confirm that * is the field separator, as Chip suggests.
 
Can you help me, I thought that I can use xml in order to get data from row file into db. Is it possible to format my example to be an XML file and then transfer into db?
Any idea will be helpful.
Thanks
 
Is it possible to format my example to be an XML file and then transfer into db?

Consider: you don't have an XML file to begin with. You have two options:

Option 1:
Step 1. Convert flat file to XML file.
Step 2. Import XML file into database.

Option 2:
Step 1. Import flat file into database.

Is option 1 possible? Yes. Is it a better choice than option 2? Unlikely.

So, let me ask you: why do you want to pick option 1?
 
I am learning XML and I for learning purpose I would like to know how to do this?
I know how to load a data from file to db, however it would be really nice to know xml also.
Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top