Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1759

Re: load multiple txt files to sql server

Newsgroups comp.databases.ms-sqlserver
Date 2014-05-25 03:21 -0700
References <a76c710f-76e8-4cfd-b098-9f0d3a2e5897@googlegroups.com> <XnsA3376359BB035Yazorman@127.0.0.1> <fbb48642-a3cf-4bc8-a7c0-f00722965b80@googlegroups.com> <25f5fd22-e8a7-4a0e-964e-f9a7652e04c6@googlegroups.com> <XnsA337DF5B97B3FYazorman@127.0.0.1>
Message-ID <04fadaf8-f15e-4062-81e8-b3a1d3b22657@googlegroups.com> (permalink)
Subject Re: load multiple txt files to sql server
From bradbury9 <ray.bradbury9@gmail.com>

Show all headers | View raw


El sábado, 24 de mayo de 2014 21:57:24 UTC+2, Erland Sommarskog  escribió:
> tad na (teddybubu@gmail.com) writes:
> 
> > All txt files have the same column structure so that is a big relief. 
> 
> > I like the idea of creating one table but the problem is each txt file
> 
> > does not have a column with the country name.  How can I insert a new
> 
> > column with the country name when importing to sql server? 
> 
> > 
> 
> 
> 
> The program that controls the load, would real the file and add the country 
> 
> name when inserting the rows. If you use BCP/BULK INSERT, you would have to 
> 
> change the default before each file. 
> 
> 
> 
> There are plenty of options available, and which one you chose is largely
> 
> up to your skills. That is, if you know C#, you write a C# program. If 
> 
> you VBscript you do it VBscript etc.
> 
> 
> 
> -- 
> 
> Erland Sommarskog, Stockholm, esquel@sommarskog.se

If you want to do it just using sql server tools, go SSIS. If you dont mind programming a bit, write a program. Depends on what you are more comfortable with.

If you go the SSIS way, you will have to use the scripting task, loops, and ssis variables. If you use a programming language you will work with same tools plus it may be easier to debug/test (if you use decent programming tools xD). 

I am very familiar with programming cause I work as a developer and I like C# a lot.

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

load multiple txt files to sql server tad na <teddybubu@gmail.com> - 2014-05-23 19:42 -0700
  Re: load multiple txt files to sql server Erland Sommarskog <esquel@sommarskog.se> - 2014-05-24 09:45 +0200
    Re: load multiple txt files to sql server bradbury9 <ray.bradbury9@gmail.com> - 2014-05-24 04:20 -0700
      Re: load multiple txt files to sql server tad na <teddybubu@gmail.com> - 2014-05-24 09:32 -0700
        Re: load multiple txt files to sql server Erland Sommarskog <esquel@sommarskog.se> - 2014-05-24 21:57 +0200
          Re: load multiple txt files to sql server bradbury9 <ray.bradbury9@gmail.com> - 2014-05-25 03:21 -0700
      Re: load multiple txt files to sql server rja.carnegie@gmail.com - 2014-05-24 15:30 -0700
        Re: load multiple txt files to sql server tad na <teddybubu@gmail.com> - 2014-05-24 20:50 -0700
        Re: load multiple txt files to sql server Erland Sommarskog <esquel@sommarskog.se> - 2014-05-25 11:16 +0200

csiph-web