Results 1 to 3 of 3

Thread: Using Linked Server with Visual FoxPro

  1. #1
    Jeremy Guest

    Using Linked Server with Visual FoxPro

    I have a Foxpro database that I have successfully setup as a linked server. I can run select statements and have data returned but what I really need to do is an insert to the table. When I try running the following statement I get an error. Could some explain to me how to get this to work?

    SELECT * FROM OPENQUERY(ARISTO, 'INSERT INTO StopOrd VALUES ;
    ("03261", "ST", "CV", "Testing", "C&#34&#39


    Server: Msg 7321, Level 16, State 2, Line 1
    An error occurred while preparing a query for execution against OLE DB provider 'MSDASQL'.
    [OLE/DB provider returned message: [Microsoft][ODBC Visual FoxPro Driver]Syntax error.]

  2. #2
    Jim Steiner Guest

    Using Linked Server with Visual FoxPro (reply)

    I think it is the openquery statement. This is TSQL syntax. Try a straight forward SQL statement, something like:

    insert into stopord
    select * from ...


    ------------
    Jeremy at 5/21/2002 11:52:24 AM

    I have a Foxpro database that I have successfully setup as a linked server. I can run select statements and have data returned but what I really need to do is an insert to the table. When I try running the following statement I get an error. Could some explain to me how to get this to work?

    SELECT * FROM OPENQUERY(ARISTO, 'INSERT INTO StopOrd VALUES ;
    ("03261", "ST", "CV", "Testing", "C&#34&#39


    Server: Msg 7321, Level 16, State 2, Line 1
    An error occurred while preparing a query for execution against OLE DB provider 'MSDASQL'.
    [OLE/DB provider returned message: [Microsoft][ODBC Visual FoxPro Driver]Syntax error.]

  3. #3
    Martyn Hodgson Guest

    Using Linked Server with Visual FoxPro (reply)

    You should try to get used to using the 4-part name syntax for tables names with linked servers, rather than using the openquery function. For FoxPro this is simply:

    select * from lsName...tablename

    When you get used to this syntax, you should be able to manpiulate data in your linked servers just as if they were local tables. This assumes, of course, that your linked servers support DML statements (FoxPro should because it uses the Jet OLEDB provider).

    Cheers

    Martyn Hodgson

    ------------
    Jim Steiner at 5/21/2002 3:45:49 PM

    I think it is the openquery statement. This is TSQL syntax. Try a straight forward SQL statement, something like:

    insert into stopord
    select * from ...


    ------------
    Jeremy at 5/21/2002 11:52:24 AM

    I have a Foxpro database that I have successfully setup as a linked server. I can run select statements and have data returned but what I really need to do is an insert to the table. When I try running the following statement I get an error. Could some explain to me how to get this to work?

    SELECT * FROM OPENQUERY(ARISTO, 'INSERT INTO StopOrd VALUES ;
    ("03261", "ST", "CV", "Testing", "C&#34&#39


    Server: Msg 7321, Level 16, State 2, Line 1
    An error occurred while preparing a query for execution against OLE DB provider 'MSDASQL'.
    [OLE/DB provider returned message: [Microsoft][ODBC Visual FoxPro Driver]Syntax error.]

Posting Permissions

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