Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

collation query

Status
Not open for further replies.

baboudi

Technical User
Oct 18, 2007
34
GB
Hi all,

I am trying to use a collation query to find out any discrepencies within dbs/colums

E.g
query below gives me: SQL_Latin1_General_CP1_CI_AS
SELECT DATABASEPROPERTYEX(DB_name(), 'Collation') collation;

then I try the query below on the same database:
select collation from test where (collation != DATABASEPROPERTYEX(DB_NAME(), 'Collation'))

result:

Latin1_General_CI_AS_KS_WS

for the query to run properly I have to replace the
(collation != DATABASEPROPERTYEX(DB_NAME(), 'Collation'))
with
(collation != 'SQL_Latin1_General_CP1_CI_AS')

Is there anyways to modify the query to get the proper results without having to specify the actual collation in the query?

tried a variation without success:

declare @collation sql_variant
select @collation = DATABASEPROPERTYEX(DB_name(), 'Collation')

select collation from test where collation != @collation

many thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top