Does it _have_ to be contained in a single column within SQL, instead of
four columns, as it should be?
If SQL (MS SQL?) doesn't have an import capable of parsing the text file
into four columns, then you could easily import it using CF.
If the third column never contains a space, you could treat each line as a
list delimited by white space. Or, just as easily, you could treat each
field as fixed in length.
<cfset crlf = Chr(13) & Chr(10)>
<cffile action="read" file="somefile.txt" variable="x">
<cfloop index="theline" list="#x#" delimiters="#crlf#">
<cfset field1 = ListGetAt(theline, 1, " ")>
<cfset field2 = ListGetAt(theline, 2, " ")>
<cfset field3 = ListGetAt(theline, 3, " ")>
<cfset field4 = ListGetAt(theline, 4, " ")>
<cfquery datasource="#mydsn#">
INSERT INTO mytable (msgdate, msgtime, device, message)
VALUES '#field1#', '#field2#', '#field3#', '#field4#'
</cfquery>
</cfloop>
One change you'd probably want to make to the above code would be to have a
date/time field in your table and combine the date and time stamps from the
text file into this one value and store it using an ODBC date/time value.
Jim
----- Original Message -----
From: "Joshua Tipton" <[EMAIL PROTECTED]>
To: "CF-Server" <[EMAIL PROTECTED]>
Sent: Tuesday, January 09, 2001 4:36 PM
Subject: Searching
> I have a text file that I imported into SQL. here is a sample of it:
>
> 20010107 132319 MSG Message Engine is Started.
> 20010107 134037 JOB Job Engine is Started.
> 20010107 134038 MSG Message Engine is Started.
> 20010107 134041 DB Database Engine is Started.
> 20010107 134042 TAPE NEW DEVICE 1, [DEC DLT2000 15/30 GB840B]
> 20010107 134042 TAPE Device added to group
> 20010107 134042 TAPE Tape Engine is Started.
> 20010107 134853 DB Database Engine is Stopped.
> 20010107 135214 JOB Job Engine is Started.
> 20010107 135215 MSG Message Engine is Started.
> 20010107 135219 DB Database Engine is Started.
> 20010107 135220 TAPE Tape Engine is Started.
> 20010107 140022 JOB Job Engine is Started.
> 20010107 140023 MSG Message Engine is Started.
> 20010107 140026 DB Database Engine is Started.
> 20010107 140027 TAPE Tape Engine is Started.
> 20010107 140918 JOB Job Engine is Started.
> 20010107 140918 MSG Message Engine is Started.
> 20010107 140920 DB Database Engine is Started.
> 20010107 140922 TAPE Tape Engine is Started.
>
>
> When it is put into the database it is all in one column. I want to know
> how can I search that column using cf and only return info that i want
from
> a certain date.
>
> I tried
> Select *
> from log <!--table name-->
> where arclog = '200102107'
>
>
> It returns nothing. Would I be better off to use cffile and make it just
> read the file where it is on the server?
>
>
> Joshua Tipton
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
------------------------------------------------------------------------------
To unsubscribe, send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body or visit the list page at www.houseoffusion.com