Automatic Import?
-
I need to take a delimited file and import it into a SQL table. The table is already setup and I have MANUALLY imported the file to populate it and get it going. This file will be updated EVERY night and I want to keep the table updated. How do I automate this? What is the SQL code? Should I drop the table and re-create it nightly?
-
I need to take a delimited file and import it into a SQL table. The table is already setup and I have MANUALLY imported the file to populate it and get it going. This file will be updated EVERY night and I want to keep the table updated. How do I automate this? What is the SQL code? Should I drop the table and re-create it nightly?
In your DTS task (You do have a DTS task, don't you?! :-D ), issue a
TRUNCATE TABLE
command to delete all rows from the table, and then import the data. -
I need to take a delimited file and import it into a SQL table. The table is already setup and I have MANUALLY imported the file to populate it and get it going. This file will be updated EVERY night and I want to keep the table updated. How do I automate this? What is the SQL code? Should I drop the table and re-create it nightly?
Reply to the forum, please! Robby wrote: i appreciate the information, but is there anyway you can give a code example? i have never created a table from a txt file, only standard SQL INSERT stuff. the file is pipe delimited and column names are on first row...any ideas? Thanks, Robby
- Open up SQL Server Enterprise Manager.
- Right-click on the target database, and choose
All Tasks -> Import Data
. - For the source, choose
Text File
, and select your text file. - Follow the instructions to set up the import.
- In the final screen, select
Scheduled DTS package for later execution
, and click on the "...
" button to set up the schedule.