Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Read text files

Author  Topic 

sp_wiz
Yak Posting Veteran

55 Posts

Posted - 2001-12-12 : 07:58:55
I have a project that requires me to read 4000 text files into a
sql table..

The tables schema is
ProductID int
ProductFileName varchar(200)
ProductDescription varchar(4000)

The product description is what is in all the text files. The ProductFilename contains the name of the file.

This seems to work for a single file, but i really need each description on its own row with a product id


Declare @filename sysname
set @filename = 'C:\Inetpub\wwwroot\diy\text Descriptions\0001.txt'
CREATE TABLE #tempfile (line varchar(8000))
EXEC ('bulk INSERT #tempfile FROM "' + @filename + '"')
SELECT * FROM #tempfile

Can anyone help or had experience with such a problem

robp




sica
Posting Yak Master

143 Posts

Posted - 2001-12-12 : 10:01:05
What is the problem ?Can't you save the file name as well in the table?

Sica

Go to Top of Page

sp_wiz
Yak Posting Veteran

55 Posts

Posted - 2001-12-13 : 08:34:34
Yeah I can't seem to get the syntax right

Cheers

Robp


Go to Top of Page
   

- Advertisement -