Friday, 22 March 2024

How to find a particular table or any keyword from all stored procedures of database

We can find it by simple SQL query: -


SELECT name,create_date, modify_date, type

FROM sys.procedures

WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%Table_Name_Or_Any_Keyword%'

Sunday, 22 May 2022

How to get alert message before redirect a page

In this article, I will explain how to display JavaScript alert message box and the redirect to another page or website when "OK" Button is clicked.


ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('User details saved sucessfully');window.location = 'anotherpage.aspx'; ", true);

Find all tables containing particular column

 

In this article, I am explaining how to find all tables containing a particular column of SQL statements.

Search Tables:

SELECT c.name  AS 'ColumnName' ,t.name AS 'TableName'

FROM sys.columns c

JOIN sys.tables  t   ON c.object_id = t.object_id

WHERE c.name LIKE '%my_column_name%'

ORDER BY TableName,ColumnName


Search Tables & Views:

SELECT  COLUMN_NAME AS 'ColumnName' ,TABLE_NAME AS  'TableName'

FROM  INFORMATION_SCHEMA.COLUMNS

WHERE  COLUMN_NAME LIKE '%MyName%'

ORDER BY TableName, ColumnName