Cannot resolve collation conflict for column 1 in SELECT statement

SELECT TABLE_SCHEMA+'.'+name FROM Cognos_Security.dbo.sysobjects,INFORMATION_SCHEMA.COLUMNS WHERE name  =TABLE_NAME and type = 'U'
--Gives "Cannot resolve the collation conflict in the equal to operation." error

I changed it to
SELECT TABLE_SCHEMA+'.'+name FROM Cognos_Security.dbo.sysobjects,INFORMATION_SCHEMA.COLUMNS WHERE name COLLATE DATABASE_DEFAULT =TABLE_NAME COLLATE DATABASE_DEFAULT and type = 'U'

Now it gives the "Cannot resolve collation conflict for column 1 in SELECT statement." error.

what is the cause for this?
LVL 6
anushahannaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Om PrakashCommented:
Please check the following KB:
Schema: How do I show the columns for a table?
http://databases.aspfaq.com/schema-tutorials/schema-how-do-i-show-the-columns-for-a-table.html

0
halfbloodprinceCommented:
See if this helps:

Cannot resolve collation conflict for equal to operation.

In MS SQL SERVER, the collation can be set in column level. When compared 2 different collation column in the query, this error comes up.

SELECT ID
FROM ItemsTable
INNER JOIN AccountsTable
WHERE ItemsTable.Collation1Col = AccountsTable.Collation2Col

If columns ItemsTable.Collation1Col and AccountsTable.Collation2Col have different collation, it will generate the error “Cannot resolve collation conflict for equal to operation“.

To resolve the collation conflict add following keywords around “=” operator.

SELECT ID
FROM ItemsTable
INNER JOIN AccountsTable
WHERE ItemsTable.Collation1Col COLLATE DATABASE_DEFAULT
= AccountsTable.Collation2Col COLLATE DATABASE_DEFAULT

0
halfbloodprinceCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anushahannaAuthor Commented:
Thanks. Right on.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.