Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Erland Sommarskog Newsgroups: comp.databases.ms-sqlserver Subject: Re: load multiple txt files to sql server Date: Sat, 24 May 2014 21:57:24 +0200 Organization: Erland Sommarskog Lines: 17 Message-ID: References: <25f5fd22-e8a7-4a0e-964e-f9a7652e04c6@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Info: mx05.eternal-september.org; posting-host="0c412830dbc354c08130c47cfccdbc83"; logging-data="21019"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+8p8irqeg8up+cA+RwRsE9" User-Agent: Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32) Cancel-Lock: sha1:IzG924SO9khWggVfomHtqTYxW04= Xref: csiph.com comp.databases.ms-sqlserver:1755 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