Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8558175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:45:01+00:00 2026-06-11T15:45:01+00:00

I am trying to get some SQL server tables into FoxPro dbf. I successfully

  • 0

I am trying to get some SQL server tables into FoxPro dbf.

I successfully managed to bcp export data such that when I use FoxPro Import Wizard, the data imports correctly. But when I try to do it at the command line, I can at best import the first few columns and all the other columns disappear.

In the following directory, I put both the .CSV file and the successful DBF import table.

directory with 2 files here

What I need to figure out is how to import these CSV files from the command line in FoxPro.

I tried various combinations of;

APPEND FROM D:\work\oh\output\sqloutput.csv TYPE CSV
APPEND FROM D:\work\oh\output\sqloutput.csv DELIMITED WITH TAB

None of it works.

Any ideas? I know I have done this before, I don’t remember what the trick was…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:45:02+00:00Added an answer on June 11, 2026 at 3:45 pm

    Wow.. I think you are going about it the wrong way… Just do a simple SQLCONNECT() to the SQL Database, run a query to the data source, stored procedure, or whatever and it’s in a cursor in VFP… Then, you can just “copy” to a DBF and you are done… Something like

    lnH = SQLCONNECT()
    

    (dialog pops up for you of ODBC connections).

    if not that, you could do

    lnH = SQLStringConnect("Provider=... for sql server, server name, etc")
    

    Then

    if lnH > 0
       sqlexec( lnH, "select * from someTableOnServer where whateverConditon", "C_LocalCursor" )
    
       select C_LocalCursor
       copy to PermanentTable
    
       sqldisconnect( lnH )
    endif 
    

    Now, if there are columns that are longer than 10 character column names, and you are NOT using a database container, you might have to adjust by either changing the query to GET the column names, or re-select the data once local to fit into 10 character non-dbc table context.

    Another example to build out the query could be — for simplicity of readability while typing, I use text/endtext such as

    text to lcSQLCmd noshow pretext 1+2
       select
             t1.Column1,
             t1.AVeryLongColumnName as AVLColName,
             t1.AnotherLongColumn2  as ALC2,
             t1.SomeFlag,
             t2.ColumnFromAnotherTable as CFATbl,
             t2.AnotherCol
          from
             SQLDatabase.dbo.SQLTable1 t1
                join SQLDatabase.dbo.SQLTable2 t2
                   on t1.SomeKey = t2.SomeKey
          where
             t1.SomeCriteria = 'whatever'
          order by
             t1.SomeFlag
    endtext
    
    */ Then, to "clean up" the string for VFP to pass properly, 
    */ strip out the cr/lf from the text such as
    lcSQLCmd = chrtran( lcSQLCmd, chr(13)+chr(10), "" )
    
    */ THEN, pass this command through sqlexec()
    sqlexec( lnH, lcSQLCmd, "C_LocalCursor" )
    

    The second is obviously MUCH easier to read what you are trying to get, and notice I’ve also pre-shortened the long column names to VFP 10 char non-DBC column name limit. Then, just copy out like the first example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm simply trying to get data from two sql server db tables using ado.net
I'm trying to get some data from a certain web-based api using the libcurl
I'm trying to get some data out my templates to, let's say, add an
i'm trying to migrate some data from two tables in an OLD database, to
I'm trying to export from SQL Server to Oracle a table that consists of
I am trying to retrieve data from an SQL server using pyodbc and print
I'm trying to insert some data from a XML document into a variable table.
Trying to archive some data from one database table to another over linked server
we're trying to get some statistics over our large log tables on MySQL. Some
Im trying to get some auto complete to work. I have this URL i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.