Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I get the names of all the tables in a database?

0 views
Skip to first unread message

aw...@truelink.com

unread,
Mar 19, 1998, 3:00:00 AM3/19/98
to

What I need to do is within a loop, call checkident on all the tables in a
database. I was wondering if there is a way of getting the names of each and
every table in a database through Transact-SQL.

If anyone can help me, please email me.

Thanks,
Arnold

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading

Michael Yocca

unread,
Mar 19, 1998, 3:00:00 AM3/19/98
to

look at http://www.acedb.com/sql/sp/ident.htm
--
Michael Yocca
SQL Server and ERwin Consultant
Ace Database www.acedb.com
Where data quality helps to prevent rework
mi...@acedb.com


aw...@truelink.com wrote in article <6erh3t$l5m$1...@nnrp1.dejanews.com>...

Guy Levin

unread,
Mar 19, 1998, 3:00:00 AM3/19/98
to

select name from sysobjects where type = 'u' [ 's']
use 'u' for user tables
use 's' for system tables

Guy Levin
Workgroup Consultants

bhaskar.ra...@prudential.com

unread,
Mar 19, 1998, 3:00:00 AM3/19/98
to

In article <6erh3t$l5m$1...@nnrp1.dejanews.com>,

aw...@truelink.com wrote:
>
> What I need to do is within a loop, call checkident on all the tables in a
> database. I was wondering if there is a way of getting the names of each
and
> every table in a database through Transact-SQL.
>
> If anyone can help me, please email me.
>
> Thanks,
> Arnold
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
>
Here you go....

select name from sysobjects where type="U"
go

Jeff Block

unread,
Mar 22, 1998, 3:00:00 AM3/22/98
to

On Thu, 19 Mar 1998 10:28:47 -0600, aw...@truelink.com wrote:

>What I need to do is within a loop, call checkident on all the tables in a
>database. I was wondering if there is a way of getting the names of each and
>every table in a database through Transact-SQL.
>
>If anyone can help me, please email me.
>
>Thanks,
>Arnold
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/ Now offering spam-free web-based newsreading

Every database has a table called sysobjects,user defined tables have
a type = 'U' - here is a script to create an SP that updates stats on
all tables:

CREATE PROCEDURE reservations_update_statistics
as

declare listtables cursor
for select name from sysobjects where type = 'U' for read only

declare @name varchar(40)


open listtables


f
etch
next from listtables into @name


while @@fetch_status = 0
begin


EXECUTE ("UPDATE STATISTICS " + @name)


fetch next from listtables into @name

end




deallocate listtables


0 new messages