Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Append from SQL Server
Message
From
08/01/2007 16:24:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/01/2007 15:31:17
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01183574
Message ID:
01183597
Views:
18
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform