1. How I find a particular column name within all tables of SQL server datbase.
For example, I have a database named
. I have more than one table where
column is present.
Most of the time, we have to find such a column from the whole database. The solution is provided below:
select table_name,column_name from information_schema.columns
where column_name like '%tax%'
Here I am searching for
which contains tax
within its name. It will return all the tables and respective columns containing tax.
2. How to search stored procedures containing a particular text?
Below is the the solution. Suppose I need to find
. The below query will return all
select routine_name, routine_definition
where routine_definition like '%tax_id%'