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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 find tables name in sql

Author  Topic 

hamedkh
Starting Member

2 Posts

Posted - 2011-01-16 : 14:36:21
hi
im new in sql .i want to write a procedure that it can find tables name in database ,for ex,if i have three table in my database ,i can find thier name,
what can i do??????

thanks
im sorry for my bad writing

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-01-16 : 14:58:17
SELECT name FROM sys.Tables;
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2011-01-16 : 15:52:37
INFORMATION_SCHEMA.Tables will also work.



Poor planning on your part does not constitute an emergency on my part.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-01-16 : 17:02:35
IF OBJECT_ID('Table1') IS NULL -- NOT FOUND
IF OBJECT_ID('Table1') IS NOT NULL -- FOUND



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-01-18 : 09:56:10
EXEC sp_tables

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -