Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

How to import non-delimited text file Expand / Collapse
Author
Message
Posted Monday, July 8, 2013 7:36 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 6:12 PM
Points: 3,609, Visits: 5,220
reid.kell (7/3/2013)
...

I need two of the 35 values (SubnetMask and SubnetDescription) for each of the 5000+ records in this long, continuous file. ...


reid.kell (7/8/2013)
Dwain.c, your code generates a single output row, not one for each record (comprising 35 rows) in the source file.


Isn't that what Luis and I gave you?



My mantra: No loops! No CURSORs! No RBAR! Hoo-uh!

My thought question: Have you ever been told that your query runs too fast?

My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.


Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
Post #1471408
Posted Tuesday, July 9, 2013 4:47 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, June 12, 2014 6:29 PM
Points: 8, Visits: 43
No. In my scenario, Luis' routine correctly generates 5000 records; yours generates one. In my text file, each "record" spans 35 lines. There are 35 lines x 5000 records = 175,000 lines in the text file. I need 5000 results, which Luis' routine produces. It's possible I didn't implement your solution correctly.
Post #1471896
Posted Tuesday, July 9, 2013 6:46 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 6:12 PM
Points: 3,609, Visits: 5,220
reid.kell (7/9/2013)
No. In my scenario, Luis' routine correctly generates 5000 records; yours generates one. In my text file, each "record" spans 35 lines. There are 35 lines x 5000 records = 175,000 lines in the text file. I need 5000 results, which Luis' routine produces. It's possible I didn't implement your solution correctly.


I asked that question because I thought I had run Luis's query against your sample data and then wrote my query to match its results set. Perhaps I'm mistaken.

If you've got something that works for your case, I say go with it!



My mantra: No loops! No CURSORs! No RBAR! Hoo-uh!

My thought question: Have you ever been told that your query runs too fast?

My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.


Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
Post #1471905
Posted Tuesday, July 9, 2013 7:34 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, June 12, 2014 6:29 PM
Points: 8, Visits: 43
Understood, and agreed. I very much appreciate your input, though. Going to study your method and learn from it -- very interesting.
Post #1471911
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse