simplest way to do a recurring text file upload to sql server

前端 未结 3 1301
灰色年华
灰色年华 2021-01-24 01:17

i have a TAB DELIMITTED log file where new data in this log file needs to be dumped into a sql server 2008 database. i am wondering what is the best way to automate this? is the

3条回答
  •  北海茫月
    2021-01-24 01:45

    The best way and the simplest way might not be the same answer. Probably the best way, since this is recurring, would be to build a SSIS job that converts the file and puts it into the database. This will allow you to put any business logic into the import (cleaning up data, insert/update if needed, kicking out errors, automation, etc.)

    Here is a simple tutorial that walks you through how to utilize SSIS to do this task:

    http://decipherinfosys.wordpress.com/2008/07/28/ssis-importing-data-from-a-text-file-using-a-package/

    If you want simple, create a little script to import the data in and then run it every time you have a file. Here is a blog entry that talks about doing an import using just SQL commands. It is for comma delimited, but you can modify it for tab delimited:

    http://blog.sqlauthority.com/2008/02/06/sql-server-import-csv-file-into-sql-server-using-bulk-insert-load-comma-delimited-file-into-sql-server/

提交回复
热议问题