Skip to main content


Showing posts from March, 2012

Searching from Entire Database

Searching from ENTIRE DATABASE is the common requirement for every dba/developer in organization.
My boss is always asking to me Suman Check this 958200000 MOBILE NUMBER or  E-ID where is available and replace with this new number, he/she left the Position but still getting notification in mail or alert in mobile…  It was very time consuming task for me …
But Now this is easy for me for finding. Just running the below query and after few minute gives the table name-column name and value where it contains………….. I am using below TSQL just try……….. DECLARE @SearchingText nvarchar(256) SET  @SearchingText = 'XXXXXXXXXXXXX' BEGIN CREATETABLE #Results(ColumnName nvarchar(370), ColumnValue nvarchar(3630)) SETNOCOUNTON DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110) SET  @TableName ='' SET @SearchStr2 =QUOTENAME('%'+ @SearchingText +'%','''') WHILE @TableName ISNOTNULL BEGIN SET @ColumnName ='&#…