25 April 2012

Search Columns in Information_Schema

-----start-----
select * from INFORMATION_SCHEMA.columns
where column_Name = 'NIK'
order by table_name
-----end-----




-----start-----
declare @gabunganTable varchar(255)
set @gabunganTable = ''
SELECT @gabunganTable = @gabunganTable +  Table_Name + ';'
FROM INFORMATION_SCHEMA.columns
WHERE len(@GabunganTable)<200
AND  column_Name = 'NIK'
SELECT @gabunganTable
-----end-----

-----Results:-----
--------------------------------------
Absensi;MsKaryawan;Mutasi;
(1 row(s) affected)