sql server 2008 - find which tables contain specific text -


i have database has few hundred tables

i need find specific string in of columns in of tables.

how approach problem>??

to find table columns use:

select table_name=sysobjects.name,          column_name=syscolumns.name     sysobjects      join syscolumns on sysobjects.id = syscolumns.id     join systypes on syscolumns.xtype=systypes.xtype    sysobjects.xtype='u' order sysobjects.name,syscolumns.colid 

if want data in tables use dynamic sql can on these lines:

declare @sql varchar(100) declare @temp table (ind int, tablename nvarchar(100))  insert @temp select row_number() over(order [name]), [name] (     select [name]     sys.tables ) d  declare @index int set @index = 1 while @index < (select count(*) @temp) begin set @sql = ' select * ' + (select tablename @temp ind = @index)   exec (@sql) set @index = @index + 1 end 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -