SQL-Search For A Column Name In All Tables In a Database

SQL-Search For A Column Name In All Tables In a Database

If you would like to search all tables in  a database for a particular column name, here's a sample query for that:

SELECT TABLE_NAME,COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS 
WHERE COLUMN_NAME LIKE '%EmployeeNo%' 
ORDER BY TABLE_NAME

Here the column name  been searched for is -'EmployeeNo'

SQL-Search Stored Procedures For A Text

SQL-Search Stored Procedures For A Text
To search the all the stored procedures in a database for a given text :
Say you want to find all the stored procedures that have the text-'EmployeeNo' , here's how to go about it .


SELECT OBJECT_NAME(id) FROM SYSCOMMENTS WHERE [text] LIKE  '%EmployeeNo%'
AND OBJECTPROPERTY(id, 'IsProcedure') = 1 GROUP BY OBJECT_NAME(id)

SQL-How to get value of updated column

There are times you would like to update a column in a table and return the value of the updated column . Here's how to do it :


UPDATE Employee SET Salary = Salary + 1 OUTPUT INSERTED.Salary WHERE Employee_ID = 2

The key here for displaying the value is 'OUTPUT INSERTED.Salary'




ASP.NET - How To Display Animated .GIF On Postback

When designing an interactive web page, it is important for you to let the user know that  an action initiated by him/her is in progress.One...