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
 Import/Export (DTS) and Replication (2000)
 SQL Server - Reading a text file

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-10-21 : 08:28:28
Al writes "Hello. Thank you.

I am in need of sending data in a text file to an already built table in SQL SERVER.
The text file is dilemated and teh different fields will be updated.

I also need to read the file in an automated way once a day with out the user having to do anything.

I was told about mapping it, but am unfamiliar with mapping. But I don't know if that solves the automation. I guess maybe like a batch?

I am in dire need of an answer.

I hope I was clear enough to get a response.

Thank you very much.

al"

nr
SQLTeam MVY

12543 Posts

Posted - 2004-10-21 : 10:34:57
See
http://www.nigelrivett.net/ImportTextFiles.html

You will need to create something that will import the data - the link above gives an SP to do that.
Then schedule the SP to run periodically and wait for the file to turn up.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-10-21 : 13:43:46
I usually do:

1. BULK INSERT the textfile into a staging table ( or temporary #table )
2. Use SQL to move the rows from stage/#temp table into the Target table

Wrap it all up in a stored procedure.

========================================================================
...You could also create a DTS package and schedule it...
run "dtswiz" from the commandpromt


/rockmoose
Go to Top of Page
   

- Advertisement -