Thank you very much, Tom. I'll give it a try.

tom muck wrote:

> <CFQUERY NAME="rs"
>  DBTYPE="dynamic"
>  CONNECTSTRING=
> "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=c:\mydirectory\;
> Extensions=asc,csv,tab,txt;Persist Security Info=False;"
> >
> SELECT first,last from testnames.csv
> </CFQUERY>
> <cfloop query="rs">
> <cfquery name="myinsert" datasource="mydsn">
> Insert into employees (firstname,lastname) values ('#rs.first#','#rs.last#')
> </cfquery>
> </cfloop>
>
> This works in CF 5 using a dynamic connection to the directory where the
> text file is located.  You can do it in CF 4.5 by setting a dsn to the
> directory using the MS text driver.
>
> I have some info on dynamic connections at
> http://www.basic-ultradev.com/articles/dsnlesscoldfusion
>
> tom
>
> "Nathan Chen" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Thank you, David, that's my next best option.  My goal is to execute the
> select and insert query from a cfm page
> > without any manual work.
> >
> >
> > David Baskin wrote:
> >
> > > Nathan, if you have a comma delimited file with the data you want to
> import
> > > into a table you can do an import in Enterprise Mgr. right click on the
> > > table that you want the data in and go to all tasks > import data. point
> to
> > > the text file and follow the steps to import. HTH.
> > >
> > > d
> > >
> > > -----Original Message-----
> > > From: Nathan Chen [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, August 16, 2001 8:57 AM
> > > To: CF-Talk
> > > Subject: OT: SQL Syntax
> > >
> > > Hi, Everyone:
> > >
> > > Does anyone know how the syntax of selecting data from a text delimited
> > > file and inserting into an exiting table?  I kind of remember Oracle
> > > database provides this kind of tool but not sure how.  I am now using MS
> > > SQL Server 7.0
> > >
> > > The simplied situation will something like this:  a text file that
> > > consists of two columns, first_name, last_name.(tab delimited or space
> > > delimited).  I need to select data in these columns and then insert them
> > > into a table that consists of two columns, first_name, last_name.  I
> > > thought this would be a simple task but can't find any syntax in the SQL
> > > server books.  Any help is appreciated.
> > >
> > > Nathan Chen
> > >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to