Objects Query

/* Select ALL table names and column names from a given table. */

select o.name as [TableName], c.name as [ColumnName]
from sys.objects o
inner join sys.columns c ON o.object_id = c.object_id
where 0=0
and type = ‘U’
— and c.name like ‘%user%’
–and c.name = ‘person’

— select * from sys.columns where name like ‘%client%’
— select * from sys.objects

— if exists (select name from sys.tables = ‘Apples’)
— drop table Apples

About Spradlike

Husband and father, epilepsy survivor, avid percussionist, technology enthusiast...insisting on the road less traveled.
This entry was posted in SQL, Tools and Tricks and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *