Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393

    Red face Unanswered: Bulk Insert to load, ...?... to unload

    To load data from a file into a table, I use :

    BULK INSERT Base.Prop.Table
    FROM 'Path of file'
    WITH (FieldTerminator='_', RowTerminator='_\n')

    What's the command to unload a table to a file ?


    Somebody must know... help... please...

  2. #2
    Join Date
    Sep 2003
    Posts
    212

    Re: Bulk Insert to load, ...?... to unload

    Originally posted by Karolyn
    To load data from a file into a table, I use :

    BULK INSERT Base.Prop.Table
    FROM 'Path of file'
    WITH (FieldTerminator='_', RowTerminator='_\n')

    What's the command to unload a table to a file ?


    Somebody must know... help... please...
    y dont u just use a DTS package to do the load and unload?

  3. #3
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393

    Re: Bulk Insert to load, ...?... to unload

    I don't want to use DTS packages because :

    1) for the loading-----------------------------------------------------------
    - the VB-SQLServer program is installed on lots of PCs*
    - each day, these PCs download new files
    - it's the name of the files that determines in witch table it must be loaded
    - the structure of table can be changed anyday by distance by the program

    So if I use DTS packages, I'll have to create or reconstruct the packages
    each time the program wants to load datafiles.

    2) for the unloading---------------------------------------------------------
    - each time the program is shut down, it unloads some data from tables
    - the list of these tables can be changed anytime
    - the data unloaded contains some calculated colums that depends that is different for each user

    So if I use DTS packages, I'll have for each PCs users different packages and I don't want to have differences in each databases
    (for maintenance ease).



    *more than 3000 users in France

  4. #4
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621

    Re: Bulk Insert to load, ...?... to unload

    What about bcp?

  5. #5
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393

    Re: Bulk Insert to load, ...?... to unload

    I've got to put a special column delimiter
    Can I detemine it with Bcp ?

  6. #6
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621

    Re: Bulk Insert to load, ...?... to unload

    Originally posted by Karolyn
    I've got to put a special column delimiter
    Can I detemine it with Bcp ?
    Use format file.

  7. #7
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393

    Re: Bulk Insert to load, ...?... to unload

    Format file in the bcp command ???

  8. #8
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621

    Re: Bulk Insert to load, ...?... to unload

    Originally posted by Karolyn
    Format file in the bcp command ???
    bcp {[[database_name.][owner].]{table_name | view_name} | "query"}
    {in | out | queryout | format} data_file
    [-m max_errors] [-f FORMAT_FILE ] [-e err_file]
    [-F first_row] [-L last_row] [-b batch_size]
    [-n] [-c] [-w] [-N] [-V (60 | 65 | 70)] [-6]
    [-q] [-C code_page] [-t field_term] [-r row_term]
    [-i input_file] [-o output_file] [-a packet_size]
    [-S server_name[\instance_name]] [-U login_id] [-P password]
    [-T] [-v] [-R] [-k] [-E] [-h "hint [,...n]"]

  9. #9
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393

    Re: Bulk Insert to load, ...?... to unload

    Mister 4 star Snail... I bow and thank you.

  10. #10
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621

    Re: Bulk Insert to load, ...?... to unload

    Originally posted by Karolyn
    Mister 4 star Snail... I bow and thank you.
    For France I could do anything

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •