Export Query Result to DBF file(foxpro)

  • hi all.

    I want to export query result to DBF file(foxpro) and MDB file(access) IN SQL SERVER 2008 with T-Sql.

    does bcp support dbf export? does bcp support mdb export?or is there any way for this?please give me a sample code for this.thanks

  • bcp won't convert direct to those formats. You would have to export (to say, CSV) then import into those other databases.

    Another option is to write your own conversion program to read SQL server data and produce an mdf or whatever format you need. The problem would be finding documentation on the output file formats.

    The probability of survival is inversely proportional to the angle of arrival.

  • I want export query result to new dbf but opendatasource export to existing dbf.is there any way for this?I must to do this with T-Sql.and export to new mdb too.

  • I've never exported directly from SQL Server to FoxPro. I've done it several times to an Access MDB where the Access MDB is a linked server. There were no problems with the export to Access. I suggest you look up linked servers - there are lots of examples if you Google it.

    Todd Fifield

  • Here's what i normally do in VFP

    1. In Windows, create an ODBC and that point to the database and named it example "MYDB"

    *--------- start VFP script -----------------*

    ODBC = "MYDB"

    SQLID = "SA"

    SQLPW = "Password"

    SQLSTR = "Select * from mytable"

    Store SQLConnect(ODBC,SQLID,SQLPW) to CurrSession

    Recordset = SQLExec(CurrSession,SQLSTR,ODBC)

    set safety off

    COPY TO MyLocalTable

    set safe on

    =SQLDisconnect(CurrSession)

    CLOSE ALL

    *--------- end of script -----------------*

    You should be able to get any query into native Foxpro this way.

    Please try =)

  • You can select your query into some temporary table on a server, and then import this table to a DBF file using DBF Commander

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply