Jul 20, 2005
Hi There,I am looking for information on how to import the txt or csv file tothe multiple table in sql 2000. If you have any kind of inf. pleaselet me know wheather we can do this and how.below is the detail information.I received txt file every day which contain the information from 3different related table in my sql 2000 database. Right now we arekeyin the information from the web site (which is link to the txtfile) to our database, but i am wondering if we can import thoserecord in the tables.the header of the file goes to table1 and when we insert the record intable1, it should generate the autoidentityrecord (PK), and that PK islink to other table2 and table3 where rest of the information from txtfile goes. For table2 and table3 there are multiple record per txtfiles.in our txt file each row is separated with row header, like HTC100WITH ROW NO. 1,2,3.., which indecate this information goes to tableand 1,2....are the different row number.Please let me know whether we can achive this task or not.Thanks for all you help in advance.Indra.I have pasted my txt file below:========"FHS000",20041029,0900,,"10",1,"TRAILB10_20041029_1B",3,"2.20","Pason-DataHub",,"#Well 1098831406 Tour 2004/10/29 Trailblazer 10 148",1,"EDR_3-0-10_HF2ETS 2.2""CON000",1,0000,0759"CON000",2,0800,1559"CON000",3,1600,2359"HWI010","0312857","COMPTON BRANT 15-7-18-24","COMPTON PETROLEUMCORP.","TRAILBLAZER DRILLINGCORP.","15-07-018-24W4","100/15-07-018-24W4/00","HANKPARANYCH","CURTIS FIESEL",20041029,,,"10",20041027,0600,,,"148","DD04485","VERT.","NO",,"HCO030",1,"Daily Walk Around Inspection","HP","CF""HCO030",2,"Detailed Inspection - Weekly (using checklist)","HP","CF""HCO030",3,"H2S Signs Posted (if required)",,"HCO030",4,"Well License & Stick Diagram Posted","HP","CF""HCO030",5,"Flare Lines Staked","HP","CF""HCO030",6,"BOP Drills Performed","HP","CF""HCO030",7,"Visually Inspect BOP's - Flarelines and DegasserLines","HP","CF""HDC040",1,"Rig Site Health and Safety Meeting (one/crew/month)","CF""HDC040",2,"C.A.O.D.C. Rig Safety Inspection Checklist(one/rig/month)","CF""HDC040",3,"Mast Inspection Before Raising or Lowering","CF""HDC040",4,"Crown Saver Checked","CF""HDC040",5,"Motor Kills Checked","CF""HFU050",2300,2100,,"HWE060",-5,"Deg C","COOL","WEST","SLIPPERY",,"HCS070",1,177.8,,"mm",25.3,"STELCO","J-55",8,108.44,3.84,108.44,"HCS070",2,114.3,,"mm",14.14,"STELCO","J-55",72,979.50,3.84,979.0,"HDP080",1,127,79.4,"kg/m","E",57,127,"mm","3 1/2 IF",10,"DC","HDP080",2,89,19.7,"kg/m","E",68,120,"mm","3 1/2 IF",15,"DP","HPU090",1,"F-800","EMSCO",254,"mm",,,,"HPU090",2,"F-800","EMSCO",254,"mm",,,,"HTC100",1,"Rig up and tear down""HTC100",2,"Drill Actual""HTC100",3,"Reaming""HTC100",4,"Coring""HTC100",5,"Condition Mud & Circulate""HTC100",6,"Trips""HTC100",7,"Rig Service""HTC100",8,"Repair Rig""HTC100",9,"Cut off drilling line""HTC100",10,"Deviation Survey""HTC100",11,"Wire Line Logs""HTC100",12,"Run Case & Cement""HTC100",13,"Wait on Cement""HTC100",14,"Nipple up B.O.P.""HTC100",15,"Test B.O.P.""HTC100",16,"Drill Stem Test""HTC100",17,"Plug Back""HTC100",18,"Squeeze Cement""HTC100",19,"Fishing""HTC100",20,"Directional Work""HTC100",21,"Safety Meeting""HTC100",24,"WOD""HSS110",1,1,"SWACO","N","110",,"84",,"HPA130","COMPTON BRANT 15-7-18-24",20041029,"COMPTON PETROLEUMCORP.","TRAILBLAZER DRILLING CORP.","CURTISFIESEL","10","ALBERTA","N",253"TCP130",1,,,,"kPa",140,,,,"mm",,"TCP130",2,,,,"kPa",140,,,,"mm",,"TCP130",3,,,,"kPa",140,,,,"mm",,"TTL160",1,1,0.00,0.25,0.25,21,"SAFETY MEETING WITH TONG HAND""TTL160",1,2,0.25,1.75,1.50,12,"RIG TO AND RUN CASING""TTL160",1,3,1.75,2.00,0.25,7,"RIG SERVICE""TTL160",1,4,2.00,2.50,0.50,5,"CONDITION MUD & CIRC.""TTL160",1,5,2.50,2.75,0.25,21,"SAFETY MEETING WITH CEMENTERS""TTL160",1,6,2.75,3.50,0.75,12,"RIG TO AND CEMENT CASING""TTL160",1,7,3.50,6.00,2.50,1,"SET SLIPS, TEAR OUT RIG, CLEAN TANKS""TTL160",1,8,6.00,8.00,2.00,24,"WAIT ON DAYLIGHT/TRUCKS""TTL160",1,9,,,,,"CEMENT WITH BJ USING 13 TONNES OF BVF-1500 NP + .7%FL-5,GIVING 15.5 m3 OF GOOD""TTL160",1,10,,,,,"SLURRY @ 1718 kg/m3,PLUG BUMPED & HELD @ 03:30 HRSOCT 29/04.""TTL160",1,11,,,,,"RIG RELEASED @ 08:00 HRS OCT 29/04""TTL160",1,12,,,,,"MOVE TO 12-3-18-25W4""TDI170",1,"JEFF CASE",8,10,475,"Deg C",,,"RUNNING CASING",,,,,"TLN175",1,"VISUALLY INSPECT PINS, RAMS AND STOOLS PRIOR TO LAYINGOVER DERRICK""TPA180",1,1,"DRILLER",647172865,"JEFF CASE",8,,,"JC""TPA180",1,2,"DERRICK HAND",648519056,"BRYAN VANHAM",8,,,"BV""TPA180",1,3,"MOTOR HAND",651056533,"NEIL WILLIAMS",8,,,"NW""TPA180",1,4,"FLOOR HAND",640352662,"TARAS WOITAS",8,,,"TW""TPI190",1,"REG",25,,,,,,"TPI190",2,"REG",25,,,,,,"TPI190",3,"REG",25,,,,,,=====
View 4 Replies
View Related
Apr 25, 2006
I am using the Bulk Insert command and trying to import a CSV delimited text file into a table and I am having problems with the quote field delimiters ", " The command below works but it takes in all the "" quotes as well and the field delimiter comma , works only if the commas are the separators only. If I have a comma within a address field for example then the data gets imported into the wrong fields. What can I use to identify that the text qualifier is ". I don't see where I can use the bulk insert command to determine this. Is there another command that I can use or am I using this command incorrectly. I thank you in advance for any response or suggestion you may have.
BULK INSERT AdventureWorks.dbo.MbAddress
FROM 'a:mbAddress.txt'
WITH (
DATAFILETYPE = 'char',
FIELDTERMINATOR=',',
ROWTERMINATOR='',
CODEPAGE = '1252',
KEEPIDENTITY,
KEEPNULLS,
FIRSTROW=2)
Here is a sample ascii file I am importing as well you can see that 6330 has a extra comma in the address line.
"AddressAutoID","Memkey","Type","BadAddress","Address1","Address2","Address3","City","State","Zip","Foreign","CarrierRoute","Dpbc","County","CountyNo","ErrorCode","ChangeDate","UserID"
6317,26517,1,0,"1403 W. Kline Ave","","","MILWAUKEE","WI","53221","","",0.00,"MILWAUKEE",79,"",1/25/2006 0:00:00,"admin"
6318,26225,1,0,"501 Dunford Dr","","","BURLINGTON","WI","53105","","",0.00,"RACINE",101,"",1/25/2006 0:00:00,"admin"
6319,20101,1,0,"2115 Cappaert Rd #35","","","MANITOWOC","WI","54220","","",0.00,"MANITOWOC",71,"",1/25/2006 0:00:00,"admin"
6320,23597,1,0,"728 Woodland Park Dr","","","DELAFIELD","WI","53018","","",0.00,"WAUKESHA",133,"",1/25/2006 0:00:00,"admin"
6321,23392,1,0,"7700 S. 51st St","","","FRANKLIN","WI","53132","","",0.00,"MILWAUKEE",79,"",1/25/2006 0:00:00,"admin"
6322,26537,1,0,"W188 S6473 GOLD DRIVE","","","MUSKEGO","WI","53150","","",0.00,"WAUKESHA",133,"",1/26/2006 0:00:00,"admin"
6323,25953,1,0,"3509 N. Downer Ave","","","MILWAUKEE","WI","53211","","",0.00,"MILWAUKEE",79,"",1/26/2006 0:00:00,"admin"
6324,19866,1,0,"10080 E. Mountain View Lake Rd. #145","","","SCOTTSDALE","AZ","85258","","",0.00,"MARICOPA",13,"",1/27/2006 0:00:00,"admin"
6325,25893,1,0,"W129 N6889 Northfield Dr. Apt 114","","","MENOMONEE FALLS","WI","53051-0517","","",0.00,"WAUKESHA",133,"",1/27/2006 0:00:00,"admin"
6326,26569,1,0,"8402 64th Street","","","KENOSHA","WI","53142-7577","","",0.00,"KENOSHA",59,"",1/27/2006 0:00:00,"admin"
6327,24446,4,0,"83 Sweetbriar Br","","","LONGWOOD","FL","32750","","",0.00,"SEMINOLE",117,"",1/30/2006 0:00:00,"admin"
6328,19547,1,0,"4359 MERCHANT AVENUE","","","SPRING HILL","FL","34608","","",0.00,"HERNANDO",53,"",2/8/2006 0:00:00,"admin"
6329,26524,1,0,"264 Lakeridge Drive","","","OCONOMOWOC","WI","53066","","",0.00,"WAUKESHA",133,"",2/10/2006 0:00:00,"admin"
6330,23967,1,0,"3423 HICKORY ST","100 Tangerine Blvd., Brownsville, TX 78521-4368","Texas Phone Number: 956-546-4279","SHEBOYGAN","WI","53081","","",0.00,"SHEBOYGAN",117,"",2/15/2006 0:00:00,"admin"
6331,25318,1,0,"3960 S. Prairie Hill Lane Unit 107","","","Greenfield","WI","53228","","",0.00,"MILWAUKEE",79,"",2/20/2006 0:00:00,"admin"
6332,24446,1,0,"83 Sweetbriar BR","","","LONGWOOD","FL","32750","","",0.00,"SEMINOLE",117,"",2/21/2006 0:00:00,"admin"
6333,26135,1,0,"P.O. Box 8 127 Main Street","","","CASCO","WI","54205","","",0.00,"KEWAUNEE",61,"",2/21/2006 0:00:00,"admin"
View 7 Replies
View Related