Quantcast
Viewing all articles
Browse latest Browse all 9656

Re: How find column whose name starts with "string"?

select

     object_name(id) as "object_name",

     name as "column_name"

from

     syscolumns

where

     name like "xyz%"

 

Technically, this will also return columns from views and parameter names from procedures.

To really limit it to tables...

 

select

     o.name as "table_name",

     c.name as "column_name"

from

     syscolumns c, sysobjects o

where

          c.id = o.id

and    o.type in ('U', 'S')  -- User and System tables     

and    c.name like "xyz%"


Viewing all articles
Browse latest Browse all 9656

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>