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


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

Re: load multiple txt files to sql server

X-Received by 10.224.12.14 with SMTP id v14mr4892163qav.8.1400930452301; Sat, 24 May 2014 04:20:52 -0700 (PDT)
X-Received by 10.140.95.112 with SMTP id h103mr207303qge.4.1400930452188; Sat, 24 May 2014 04:20:52 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!c1no15846046igq.0!news-out.google.com!qf4ni12380igc.0!nntp.google.com!c1no15846040igq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.databases.ms-sqlserver
Date Sat, 24 May 2014 04:20:52 -0700 (PDT)
In-Reply-To <XnsA3376359BB035Yazorman@127.0.0.1>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=87.222.91.29; posting-account=jIl9nQoAAAA9P37IIqQq64yAx-2NQYiu
NNTP-Posting-Host 87.222.91.29
References <a76c710f-76e8-4cfd-b098-9f0d3a2e5897@googlegroups.com> <XnsA3376359BB035Yazorman@127.0.0.1>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <fbb48642-a3cf-4bc8-a7c0-f00722965b80@googlegroups.com> (permalink)
Subject Re: load multiple txt files to sql server
From bradbury9 <ray.bradbury9@gmail.com>
Injection-Date Sat, 24 May 2014 11:20:52 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.databases.ms-sqlserver:1753

Show key headers only | View raw


El sábado, 24 de mayo de 2014 09:45:59 UTC+2, Erland Sommarskog  escribió:
> tad na (teddybubu@gmail.com) writes:
> 
> > I need to import hundreds of data txt files to sql server 2008.
> 
> > All the txt files are in folders.  The folders names are country names.
> 
> > Obviously, I don't want to do this manually.
> 
> > This is what I want:
> 
> > 
> 
> > 1. import all country/folder names into sql server and create a table 
> 
> >      example: dbo.China
> 
> > 2. import all txt files in country/folder to specific dbo in sql server
> 
> > 
> 
> > Is this possible to do and is it done with stored procedures??
> 
> > How do I do this?  I am a beginner so any help is appreciated.
> 
>  
> 
> Is the structure of the text files the one and the same? In such case you 
> should not create a table per file or folder, but a single table. The 
> 
> folder/country name should probably be a column in that table.
> 
> As for organising the import, you would have to write a program or use
> 
> SQL Server Integration Services (which I am not familiar with myself).
> -- 
> Erland Sommarskog, Stockholm, esquel@sommarskog.se

SSIS is the way to go, but wont be a easy task, you have several tasks that can help you achieve it. You will have to play around with script task, foreach loops, variables and source / destination tasks.

Did, long time ago, the other way. from a single excel store in database and loop database views to generate excels that one app would send via email.

Some task worth mention:

foreach loop task
script task

http://msdn.microsoft.com/en-us/library/ms139892.aspx

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