Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Append from SQL Server
Message
From
09/01/2007 10:44:18
 
 
To
08/01/2007 16:48:58
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01183574
Message ID:
01183809
Views:
16
>>>>I need to append some data from SQL Server into a local table. This is my first attempt to become familiar with SQL Server and remote connections so I need a little help. I have successfully created a remote connection to the Server. This connection is named 'TRP_SQL' and is located in a database named 'newsurveys'. The data I want to append is located in a table named 'exported'.
>>>>
>>>>I have been able to create a view using the remote view designer and browse the data but I would prefer to create the view programmatically using CREATE SQL VIEW or some other suitable means. I can't seem to get the syntax right to do the job. Here is what I have:
>>>>
>>>>
>>>>close tables all
>>>>open database "\\tpdfiles\data\dfreeman\trp\data\surveys\newsurveys"
>>>>create sql view tempview connection trp_sql as select * from ...
>>>>select mytable
>>>>append from tempview
>>>>
>>>>
>>>>There seems to be a need for 2 connection parameters, how do you specify the table?
>>>>Can someone help me finish this?
>>>>
>>>>Also, do I deal with the created view the same way as a temporary cursor? Could this be done with an ordinary SELECT instead of a view? etc?
>>>>
>>>>
>>>>Thanks
>>>
>>>Don,
>>>You don't need a dbc nor a view for this. You can use ODBC/OLEDB instead. ie:
>>>
>>>
>>>* Local instance:.
>>>* Trusted_connection=yes: Use windows authentication
>>>lcConnectionString = "Driver=SQL server;server=.;Trusted_connection=yes"
>>>lnHandle = SqlStringConnect(m.lcConnectionString)
>>>SQLExec(m.lnHandle,"select * from myDatabase..myTable","resultCursor")
>>>SQLDisconnect(m.lnHandle)
>>>select resultCursor
>>>browse
>>>*select myVFPTable
>>>*append from dbf('resultCursor')
>>>
Cetin
>>
>>Thanks Cetin and Edward, you've both pointed me in the same direction which is simpler than where I was going.
>>- Don
>
>You may also keep views, that's the best way to quickly view/change data on SQL-server when you test/debug your program.
>One more tip: if you call SQL-Server stored procedure through SQLEXEC() it will also return cursor(s), if it has some Select-SQL command(s) inside.

Thanks Ed. Do you know if it's possible to use DBGETPROP to retrieve field comments from a server based table?

- Don
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform