txt import to sql

  • Hi Guys,

    I need to import .txt file into sql server 2008 R2 & i want to schedule the import.

    Kindly help me with this..

    Thanx in advance

  • is the txt file going to be the same structure everytime it is imported or is it going to change?

  • yes it will be of the same structure...

  • a few ways then, take a look at the import export data wizard which will create you an SSIS package which you can schedule, also take a look at creating your own SSIS package as you can do more than what what wizard will do like error handling etc, then there is BCP and bulk insert to take a look at, all will do the task at hand, its just which is your preference.

    personally I would go down the SSIS route.

  • as i m quite new to sql server, i have done it with simple import/export way, but if i want to schedule the same

    then how can i do that??

    can you plz provide some steps me to follow..

  • Books online has some pretty good information on importing files, using both T-SQL, bcp and SSIS:-

    http://msdn.microsoft.com/en-us/library/ms187042.aspx - direct page for BULK INSERT, bcp, OPENROWSET

    http://msdn.microsoft.com/en-us/library/ms141026.aspx - page for SSIS, this is a little wider a topic.

    You could also use the Import/Export wizard as a starter for any SSIS package for a simple import of a text file.

    Once done, you will then need to set up a SQL Server Agent job with a schedule to import the file on a regular basis.

    Follow me on twitter @EvoDBACheck out my blog Natural Selection DBA[/url]

  • the last screen before the import runs is a screen which says, run immediatly or save package as, you simply save the package, and then create an agent job to run the package

  • hi anthony,

    I am getting an error called "unable to save xml"...

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply