Advertisement

05.02.2008 at 07:50AM PDT, ID: 23371792
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

Parsing a Column - Multiple Occurances of Record (SQL Svr 2K)

Asked by dbbishop in MS SQL Server, SQL Query Syntax

SQL SERVER 2000
=============
I have a staging table (Staging) that I import text data into (a column named RecordData). From that table, I populate two other tables.
Here is an abbreviated layout of the import data and below is a sample of a couple of records:

1) acct number
2) name
3) feature 1 code
4) date feature 1 installed
5) cost of feature 1
6) feature 2 code
7) date feature 2 installed
8) cost of feature 2
9) feature 3 code
10) date feature 3 installed
11) cost of feature 3
12) more data...

I envision this as running in two passes. The first pass parses all 'fixed' data (account, name, 'more data'). The second pass would recurse parsing feature data.

In reality, there can be up to 75 occurances of 'features'. The records are all fixed lenght, which means there is space for 75 occurances even if no values.

I have the first part codes, where I load account, name, etc. into the first table (Accounts). I am trying to figure out how to efficiently load the second table (Features)

All three tables contain a column named DDE_ID. It is an identity column in the Staging table. It is carried forward to the Accounts table as the PK. There is a FeatureID column in the Features table and DDE_ID is a FK back to the Accounts table.

I need to iterate the input data up to 75 times, loading only those features that are not blank (once a blank has been found, iteration can break). For each record I insert into Features, I also need to load the appropriate DDE_ID value. The DDE_ID in Staging = DDE_ID in Accounts, so for this pahes, I do not require any reference to the Accounts table.

I've envisioned this a couple of ways, first inserting a single row containing the DDE_ID and first group of features for all rows in Staging that have at least one feature, then trying to create some kind of join logic and inserting from the 2nd-75th set of features, etc., but can't get in mind how to do this EFFICIENTLY (keyword).

This is going to be a nightly import and there can be thousands of rows.Start Free Trial
1:
2:
123456DOE, JOHN        F1200803120001245F2200804110001000F3200804010000499...
987654SMITH, MARY      F1200803120001245F2200804110001000  000000000000000...
 
Keywords: Parsing a Column - Multiple Occuranc…
 
Loading Advertisement...
 
[+][-]05.02.2008 at 08:07AM PDT, ID: 21487241

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 08:17AM PDT, ID: 21487339

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 08:20AM PDT, ID: 21487372

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 08:29AM PDT, ID: 21487455

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 08:42AM PDT, ID: 21487551

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 08:46AM PDT, ID: 21487596

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.06.2008 at 08:06AM PDT, ID: 21507914

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, SQL Query Syntax
Sign Up Now!
Solution Provided By: dbbishop
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906