Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 To: Nilson Rishi
  Where is Nilson Rishi?
 Bangkok
 Thailand
 Nilson Rishi
 Tags
Subject: RE: SQL SERVER select * from sysobjects
Thread ID: 331461 Message ID: 331497 # Views: 47 # Ratings: 1
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Friday, December 30, 2011 2:07:23 PM         
   


> Expert,
>
> For SQL Server database named myDB, I use the following 2 commands to query for its table objects. However, the 2 commands return different results. As you could see, the 1st command USE master database first, and then query from myDB..SYSOBJECTS, while the 2nd command directly USE the right database myDB and select from the same myDB..SYSOBJECTS.
> But the 1st command returns a cursor without any record.
> It seems: even though a specific database is specified for the SELECT command, the command simply ignores this but does the SELECT from the current database, e.g. MASTER.
> Is this a bug?
>
>
> USE MASTER
> SELECT * FROM myDB..SYSOBJECTS 
> WHERE OBJECTPROPERTY(id, N'IsUserTable') = 1
> 

>
>
> USE myDB
> SELECT * FROM myDB..SYSOBJECTS 
> WHERE OBJECTPROPERTY(id, N'IsUserTable') = 1
> 


No it is not a bug. It is just as it is documented. Maybe you are missing that ObjectProperty() is operating on current database.

To your chance there weren't a match to Id's in master and myDB so you get no records. That is a good thing IMHO.




Cetin Basoz

.Net has got better.Think about moving - check my blog:
My Blog
Blog (mirror) - sounds to be down


Support Wikipedia

ENTIRE THREAD

SQL SERVER select * from sysobjects Posted by Nilson Rishi @ 12/30/2011 5:05:34 AM
RE: SQL SERVER select * from sysobjects Posted by Cetin Basoz @ 12/30/2011 2:07:23 PM
RE: SQL SERVER select * from sysobjects Posted by Nilson Rishi @ 12/31/2011 7:15:03 AM