-- ========================================================================================
-- Author: Torsten Schüßler (aka: tosc)
-- Date: Sep 18th 2008
-- Spaltenname über alle Tabellen einer Datenbank suchen
-- Disclaimer: This script, is provided for informational purposes only and InsideSQL.org 
-- (aka: WWW.INSIDESQL.ORG) or the author of this script makes no warranties,either express
-- or implied. This script, scenarios and other external web site references, is subject to
-- change without notice. The entire risk of the use or the results of the use of this 
-- script remains with the user.
-- =========================================================================================

DECLARE @COL_NAME NVARCHAR(50)
SET @COL_NAME = '%VBELN%'

SELECT     DB_NAME(DB_ID()) AS Datenbank, 
                B.name AS TabllenName, 
                A.name AS SpaltenName
FROM        sys.syscolumns AS A INNER JOIN
                      sys.sysobjects AS B ON A.id = B.id
WHERE     (A.name LIKE @COL_NAME) AND (B.type LIKE 'U%')
