troubleshooting Question

SQL Query - Combine multiple rows into 1 base off keywords

Avatar of holemania
holemania asked on
Microsoft SQL Server 2005SQL
4 Comments1 Solution583 ViewsLast Modified:
I need help with a query.  I am reading a log file from a text file into a temp table.  Got this portion working, but I need help with combine multiple rows into previous row if the following rows don't have this keyword in there.

Example Raw data line by line (also row by row in table):
Line 1
Line 2
Line 3
Line 4
Line 5
Failed:  No item in db
Please verify item exists
Line 6
Line 7
Error:  Not able to verify job
Line 8

Output need in:
Line 1
Line 2
Line 3
Line 4
Line 5 Failed:  No item in db Please verify item exists
Line 6
Line 7 Error:  Not able to verify job
Line 8

Is it possible to do that?  Basically look for keyword Line since that does not exists any where else except for the Line #.  If no keyword "Line", then combine any rows with previous record that has "Line".
ASKER CERTIFIED SOLUTION
Kyle Abrahams
Director of Information Technology

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros