Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 conversion of oraclequery into T-sql query!!urgent

Author  Topic 

RGV
Starting Member

2 Posts

Posted - 2011-10-04 : 00:49:38
Hi All,
I am new to sql server and does not know much about the information schema in sql server 2008.Please let me know how to re write the below shown oracle query in sql server query format.


'select count(*) from (select OBJECT_NAME from dba_OBJECTS where owner = ''Test'' and OBJECT_TYPE = ''TABLE'')')
Thanks...........

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-04 : 00:51:33
why is it so urgent for you? Are you in a test center? or is your boss/teacher standing behind you looking for answer?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

RGV
Starting Member

2 Posts

Posted - 2011-10-04 : 06:31:14
Hi Visakh,
May be i should not have used 'Urgent' in my subject line . I was actually blocking someone's progress and hence i was in a hurry.Please let me know the answer if possible.
Thanks...
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-10-04 : 06:37:34
People here provide advice for free. We don't consider one person's request more urgent that another, and people who post URGENT on their first post are not doing themselves any favours ...

You'll need to explain what you are trying to query. There may be people here who understand Oracle, but IME the folk here who know about Oracle only have very scant knowledge.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-04 : 06:42:47
[code]
select count(*) from (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where SCHEMA_NAME = 'Test' and TABLE_TYPE = 'BASE TABLE')t
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-10-04 : 07:00:46
If that's it then this will do won't it? I looked at the original wondering why the nested query was needed in oracle.

select count(*)
from INFORMATION_SCHEMA.TABLES
where SCHEMA_NAME = 'Test'
and TABLE_TYPE = 'BASE TABLE'

but I think its relatively unlikely that the O/P will be using a schema in SQL Server (unlike Oracle where I think [what little knowledge I have] that that is what I would think of as a Database)

I'll stop wasting time guessing, a description of the problem would put us on the right track.
Go to Top of Page
   

- Advertisement -