Created
April 11, 2019 14:35
-
-
Save PRElias/70fbf4ad79e625eba75b462d7e046bce to your computer and use it in GitHub Desktop.
SQL Server all fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT SchemaName = c.table_schema, | |
TableName = c.table_name, | |
ColumnName = c.column_name, | |
DataType = data_type, | |
Validate = 'SELECT TOP 1 ' + c.column_name + ' FROM ' + c.table_name | |
FROM information_schema.columns c | |
INNER JOIN information_schema.tables t | |
ON c.table_name = t.table_name | |
AND c.table_schema = t.table_schema | |
AND t.table_type = 'BASE TABLE' | |
where c.column_name like '%tel%' | |
ORDER BY SchemaName, TableName, ordinal_position |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment