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


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

Re: load multiple txt files to sql server

From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: load multiple txt files to sql server
Date 2014-05-25 11:16 +0200
Organization Erland Sommarskog
Message-ID <XnsA33872BEA97FFYazorman@127.0.0.1> (permalink)
References <a76c710f-76e8-4cfd-b098-9f0d3a2e5897@googlegroups.com> <XnsA3376359BB035Yazorman@127.0.0.1> <fbb48642-a3cf-4bc8-a7c0-f00722965b80@googlegroups.com> <2fe392b1-5878-466c-842f-b4a40ab9f917@googlegroups.com>

Show all headers | View raw


 (rja.carnegie@gmail.com) writes:
> As for the nation value that isn't in the data file itself,
> I think you can set a constant in a format file that
> controls a BCP data import process, 

No, you can't.

> but in my experience the format file is difficult to construct 

Yes, as long as you have not learnt the format.

> But this doesn't exist if I am reading this correctly
><http://msdn.microsoft.com/en-us/library/ms179250.aspx>
> (SQL Server 2014) which says "A data file can contain 
> fewer fields than the number of columns in the table 
> only if the skipped columns are nullable and/or have 
> default value."  i.e. you can't write a default value
> into the format file to use instead.
> 

Correct. But you can change the default value for each column before
you load.

Which still it is a bit of a kludge. I would rather solve it with 
client-side language. Just because you can do it in T-SQL does not
mean that you have to.


-- 
Erland Sommarskog, Stockholm, esquel@sommarskog.se

Back to comp.databases.ms-sqlserver | Previous | NextPrevious 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