Import comma delimited file
am 28.08.2005 23:06:17 von Elmo Watson
I've been asked to develop an automated type situation where we have a
database table (sql server) and periodically, there will be a comma
delimited file from which we need to import the data, replacing the old.
I naurally know that we can use [truncate tablename] to kill the other data,
but does anyone have any examples of importing a comma delimited file into
SQL Server?
Re: Import comma delimited file
am 29.08.2005 14:21:11 von reb01501
Elmo Watson wrote:
> I've been asked to develop an automated type situation where we have a
> database table (sql server) and periodically, there will be a comma
> delimited file from which we need to import the data, replacing the
> old.
>
> I naurally know that we can use [truncate tablename] to kill the
> other data, but does anyone have any examples of importing a comma
> delimited file into SQL Server?
http://www.aspfaq.com/5003
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: Import comma delimited file
am 08.09.2005 04:17:35 von Bullschmidt
You can connect to a csv file (which can be opened in Excel and which an
Excel file can be converted into) in good form just as you can to a
regular database.
The .csv file needs to be uploaded to the server.
And you can have two recordsets open at the same time.
So I'd suggest going through this recordset one row at a time and within
this loop add a new record to the "real" database's recordset.
And for help connecting to a text file using the Jet OLE DB provider:
http://www.carlprothman.net/Default.aspx?tabid=87#OLEDBProvi derForTextFi
les
And based on the above link realize that the actual filename does NOT go
in the connection string - rather it goes in the SQL statement
(definitely a little tricky).
Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
<<
I've been asked to develop an automated type situation where we have a
database table (sql server) and periodically, there will be a comma
delimited file from which we need to import the data, replacing the old.
I naurally know that we can use [truncate tablename] to kill the other
data,
but does anyone have any examples of importing a comma delimited file
into
SQL Server?
>>
*** Sent via Developersdex http://www.developersdex.com ***