Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select * from MSDE table
Message
From
16/09/2003 12:00:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00829328
Message ID:
00829467
Views:
21
>>Assuming connection succeeded (check value) :
>>
>>SQLExec(gnConnHandle, "select * from myDB..myTable", "myCursor")
>>
>>SQL server tables are in the form :
>>Database.Owner.Table
>>Cetin
>
>Cetin,
>Thanks for the reply. Your suggestion worked wonderfully. It even worked without specifying the database owner. So my exact code was:
>
>sqlexec(gnconnhandle, "select * from myDB..myTable","myCursor")
>
>
>Is it "bad" to run the select statement without specifying the database owner?
>
>Do you know the difference or advantage for using sqlexec() compared to using a select SQL command?
>
>Thanks,
>Einar

Einar,
You might use or drop any part. ie:

Database.Owner.Table
Database..Table
Owner.Table
Table

Or even :
..Table

Might mean the same thing. ie:
lnHandle1=SQLStringConnect('DRIVER=SQL Server;'+;
  SERVER=servername;Integrated Security=SSPI')
lnHandle2=SQLStringConnect('DRIVER=SQL Server;'+;
  SERVER=servername;Integrated Security=SSPI;Database=Northwind;')

* We have 2 connection - one w/o a database set

SQLExec(lnHandle2,'select * from customers')
SQLExec(lnHandle2,'select * from dbo.customers')
SQLExec(lnHandle2,'select * from northwind.dbo.customers')

* Are equal calls

SQLExec(lnHandle1,'select * from customers') && Fail with error

SQLExec(lnHandle2,'select * from northwind.dbo.customers') && Works

SQLExec('use Northwind') && Set database
SQLExec(lnHandle1,'select * from customers') && Works

SQLDisconnect(lnHandle1)
SQLDisconnect(lnHandle2)
"Do you know the difference or advantage for using sqlexec() compared to using a select SQL command?"

With SPT you always have to use SQLExec(), or am I misunderstanding you ?

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
Reply
Map
View

Click here to load this message in the networking platform