import txt file to SQL Server DB table using ASP file. . .

G

GGill

Using VB script i will need to import text file from c:\data.txt to SQL
Server DB table (table name 'tblData'). Also if i can run vb script from asp
file using button import. Please, help me write this script.
 
T

Thomas A. Rowe

Suggest you post this to the MS SQL newsgroup as this is not a FP related issue.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
J

Jon Spivey

Hi,
This is the neat way
BULK INSERT TableName
FROM 'c:\stuff.csv'
WITH (
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)

Check BULK INSERT in books online for all the options. The only problem is
many hosts block this so unless you're on a dedicated box you may have
problems using it. The other way would be to read the file with
filesystemobject split it into an array then do an insert for each row.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top