Thursday, March 8, 2012

Check all existing collations in one database.

Hello,
Can you tell me, how can i get all collations that i have in one database. I
get the database collation but i need to verify if any table or field in the
current database have one different collation.
I've got one job that is returning the following error:
Server: Msg 457, Level 16, State 1, Procedure WsIBTLoadBatch, Line 20
Implicit conversion of char value to char cannot be performed because the
collation of the value is unresolved due to a collation conflict.
Thanks and best regars.The following will list columns in tables and views that have a collation
other than the current database default:
SELECT
o.type,
USER_NAME(o.uid),
o.name,
c.name
FROM sysobjects o
JOIN syscolumns c ON c.id = o.id
WHERE
o.type IN('U', 'V') AND
c.collation <> DATABASEPROPERTYEX(DB_NAME(), 'COLLATION')
Hope this helps.
Dan Guzman
SQL Server MVP
"CC&JM" <CCJM@.discussions.microsoft.com> wrote in message
news:31B6222F-B334-4612-853E-D27298405704@.microsoft.com...
> Hello,
> Can you tell me, how can i get all collations that i have in one database.
> I
> get the database collation but i need to verify if any table or field in
> the
> current database have one different collation.
> I've got one job that is returning the following error:
> Server: Msg 457, Level 16, State 1, Procedure WsIBTLoadBatch, Line 20
> Implicit conversion of char value to char cannot be performed because the
> collation of the value is unresolved due to a collation conflict.
> Thanks and best regars.|||Thanks Dan,
Best regards
"Dan Guzman" wrote:

> The following will list columns in tables and views that have a collation
> other than the current database default:
> SELECT
> o.type,
> USER_NAME(o.uid),
> o.name,
> c.name
> FROM sysobjects o
> JOIN syscolumns c ON c.id = o.id
> WHERE
> o.type IN('U', 'V') AND
> c.collation <> DATABASEPROPERTYEX(DB_NAME(), 'COLLATION')
>
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "CC&JM" <CCJM@.discussions.microsoft.com> wrote in message
> news:31B6222F-B334-4612-853E-D27298405704@.microsoft.com...
>
>

No comments:

Post a Comment