Posts

Showing posts from January, 2022

Find the column with the specific text in SQL

 DECLARE     @search_string  VARCHAR(100),     @table_name     SYSNAME,     @table_schema   SYSNAME,     @column_name    SYSNAME,     @sql_string     VARCHAR(2000) SET @search_string = 'test' DECLARE tables_cur CURSOR FOR SELECT DISTINCT T.TABLE_SCHEMA, T.TABLE_NAME FROM INFORMATION_SCHEMA.TABLES T WITH(NOLOCK) INNER JOIN INFORMATION_SCHEMA.COLUMNS C WITH(NOLOCK) ON t.TABLE_SCHEMA=c.TABLE_SCHEMA and t.TABLE_NAME=c.TABLE_NAME AND  c.COLLATION_NAME IS NOT NULL AND t.TABLE_NAME NOT LIKE '%1%' AND t.TABLE_NAME NOT LIKE '%2%'  AND t.TABLE_NAME NOT LIKE '%3%' AND t.TABLE_NAME NOT LIKE '%4%' AND t.TABLE_NAME NOT LIKE '%5%'  AND t.TABLE_NAME NOT LIKE '%6%' AND t.TABLE_NAME NOT LIKE '%7%' AND t.TABLE_NAME NOT LIKE '%8%'  AND t.TABLE_NAME NOT LIKE '%9%' AND t.TABLE_NAME NOT LIKE '%0%' AND t.TABLE_NAME NOT LIKE '%TEMP%'  WHERE TABLE_TYPE = 'BASE TABLE' OPEN tables_...

Law of Demeter

This is a pattern of using proper arrangements. Class Test { public int Add(int x,int y) { Return x+y; } }