Vous êtes ici :
Quelles sont les colonnes de tables avec un classement différent de celui de la base de données ?
Transact-SQL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
/*------------------------------------------------------------------- [SCRIPT] Tables_collations [DATABASE] current [DESCRIPTION] Looking for different collations between database and table columns [MAJ PAR] DATAFLY - Arian Papillon -------------------------------------------------------------------*/ -- quelles sont les tables possédant un classement différent de la base SELECT DB_NAME() AS DBName , c.TABLE_NAME , COLUMN_NAME , DATA_TYPE , CHARACTER_MAXIMUM_LENGTH , CASE WHEN IS_NULLABLE = 'YES' THEN 'NULL' ELSE 'NOT NULL' END AS Nullable , c.COLLATION_NAME AS ColumnCollation , DATABASEPROPERTYEX(DB_NAME(), 'Collation') AS DBCollation FROM INFORMATION_SCHEMA.COLUMNS c JOIN INFORMATION_SCHEMA.TABLES t ON c.TABLE_NAME = t.TABLE_NAME WHERE --(data_type = 'char' or data_type = 'varchar') and c.TABLE_NAME <> 'dtproperties' AND t.TABLE_TYPE = 'BASE TABLE' AND RTRIM(CAST(c.COLLATION_NAME AS VARCHAR(30))) <> RTRIM( CAST(DATABASEPROPERTYEX( DB_NAME() , 'Collation') AS VARCHAR(30))) ORDER BY c.TABLE_NAME; |
Table of Contents