Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Copy to

  1. #11
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,385
    Blog Entries
    22
    I have now added SET CSVHEADING ON | OFF (default ON) which will allow you to customize whether or not field headings are included in the csv text file.

    This will be available in the next build so give that a try and let me know if that works for you.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  2. #12
    I did

    create cursor test (f1 int,f2 int)
    insert into test values (1,1)
    insert into test values (3,3)
    lcfile = "c:\temp\test3.csv" && or other similar path. I used an UNC-path of our server

    Afterwards:

    OK => list
    => provides same behaviour of yours
    ?? => copy to (lcfile) type csv delimited with '|'
    => generates Name:  COPYTO.PNG
Views: 2298
Size:  4.3 KB
    OK => I opened this file with Excel via Import external data and choosed Windows (ANSI) instead of selected (??) MS-DOS (PC-8)
    => generates Name:  COPYTOXLS.PNG
Views: 2353
Size:  19.1 KB

    So the strange "optical" behaviour in windows editor is no problem for me.
    I will take a look, why the following BULK INSERT doesn't work as it does in VFP. It doesn't generate a SQLEXEC-error, handle,.. all ok, but the table in sql server is empty. In sql profiler, the statement is also ok, but it doesn't load anything

  3. #13
    I found my problem, and can solve it with SET CSVHEADING OFF

    I thought, I could ignore "new" headers of COPY TO in sql BULK INSERT by option FIRSTROW=2, but
    The FIRSTROW attribute is not intended to skip column headers. Skipping headers is not supported by the BULK INSERT statement. When skipping rows, the SQL Server Database Engine looks only at the field terminators, and does not validate the data in the fields of skipped rows.
    => see http://technet.microsoft.com/en-us/l.../ms188365.aspx

    I deleted the first line of produced csv file - as it will be exported with your new SET CSVHEADING OFF - and it works as expected

    Thanks, Claus

  4. #14
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,385
    Blog Entries
    22
    I believe it was because the text file just had a LF rather than a CRLF which I have now fixed. BULK INSERT probably balked at that.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  5. #15
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,385
    Blog Entries
    22
    Ok thats good. We will make it available in the beta directory next week with various other tickets that we have fixed. I've also increased the text buffer sizes so it should be significantly faster on large amounts of data too as it reduces disk seeks,
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  6. #16
    Great!

    Cool solutions for upcoming problems/differences to vfp, quick response,...

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us