all groups > sql server msde > may 2007 >
You're in the

sql server msde

group:

how to display table names with osql


how to display table names with osql sean nakasone
5/2/2007 12:05:01 PM
sql server msde: I'm an osql newbie and I want to simply display the table names in the
database. I'm used to oracle where we'd enter "select * from all_tables;" what's the
equivalent line in osql?
Re: how to display table names with osql Andrea Montanari
5/3/2007 12:43:26 AM
hi,
[quoted text, click to view]

PRINT 'standard INFORMATION_SCHEMA query';
SELECT TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE';

PRINT 'proprietary SQL Server 2000 specific catalog based query';
SELECT USER_NAME(t.uid) AS [Owner], t.name
FROM dbo.sysobjects t
WHERE t.type = 'U';

--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz http://italy.mvps.org
DbaMgr2k ver 0.21.0 - DbaMgr ver 0.65.0 and further SQL Tools
--------- remove DMO to reply

Re: how to display table names with osql Hari Prasad
5/4/2007 12:00:00 AM
Hello,

Login into OSQL and you can also execute the below system procedure.

Use DBname
GO
sp_Tables
GO

Thanks
Hari



[quoted text, click to view]

AddThis Social Bookmark Button