If the file is large, you can use cfexec to BCP the file into a table then
run a stored procedure to process the table and put the data where it really
needs to be.  If the file is small, just loop through it and do a series of
inserts then call a stored procedure to process the table.

Justin

> -----Original Message-----
> From: Bruce Sorge [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 20, 2002 10:40 AM
> To: CF-Talk
> Subject: Importing a text file into SQL Server table

> Hello list. I have a text file that is comma and double-quote 
> separated, with a line break that separates the lines. The 
> first row contains the header information. What I am wanting 
> to do is to import this into a SQL Server 2K table. I know 
> that I can use DTS to do this, but I need to do this in 
> ColdFusion code instead as a scheduled task. I have always in 
> the past just used DTS Wizard to do this, not straight SQL. 
> So, my question is, how do you import a text file into SQL 
> Server? What would my query look like? I already have the 
> cffile code in place looking at the text file.
> 
> Thanks,
> 
> Bruce
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Reply via email to