Login | |
|
 |
RE: how to write text file's data to MSDE - 1/8/2007 12:56:16 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
|
How do you want it stored? As text? As a binary blob? How large are the files? Will you need to use the information from the texrt file in queries?
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: how to write text file's data to MSDE - 1/11/2007 2:29:33 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
|
To be honest with you, MSDE and MS-SQL both provide facilities to pull data into the DB from a text file. I would suggest this as your best route. Failing that you could open the text file in VBS and read each line, split the line, then insert the data into the table. If you want to go the VBS route, here are some search terms that you can use to get you started findinge examples on this forum: FileSystemObject ReadLine ReadAll ODBC SQL
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: how to write text file's data to MSDE - 1/12/2007 3:16:00 AM
|
|
 |
|
| |
Country73
Posts: 735
Score: 10
Status: offline
|
You will need to find out how the information is listed in your text file. More than likely they are split up by tabs. Example of text file split by TAB: job_id TAB job_desc 1 TAB New Hire - Job not specified 2 TAB Chief Executive Officer 3 TAB Business Operations Manager 4 TAB Chief Financial Officier If that is the case, you can split it by just using the SPLIT command When you read in each line you will split the line on VBTAB (vbscripts representation of TAB) Example for reading and spliting your text file: (code tags removed for color text use) myTextFile = "<your file>" SET oFS = CreateObject("Scripting.FileSystemObject") SET oFile = oFS.GetFile(myTextFile) SET myLine = oFile.OpenAsTextStream(1,-2) DO UNTIL myLine.AtEndOfStream mySplit = SPLIT(myLine.ReadLine,VBTAB) IF mySplit(0) <> "job_id" THEN 'This will skip over the first line of your text file myJob_ID = mySplit(0) myJob_Desc = mySplit(1) CALL writeTOsql(myJob_ID,myJob_Desc) 'You will need to create your function for writing into SQL END IF LOOP SET myLine = NOTHING SET oFile = NOTHING SET oFS = NOTHING FUNCTION writeTOsql(myJob_ID,myJob_Desc) <your sql coding> END FUNCTION
< Message edited by Country73 -- 1/12/2007 3:17:05 AM >
|
|
| |
|
|
|
|
|