Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 COLLATE database_default

Author  Topic 

kt
Yak Posting Veteran

88 Posts

Posted - 2013-02-25 : 10:41:29
Hi,
I am inherited the code from previous developer and not sure why he used COLLATE database_default from his query.
Slect …..
FROM tbl1 a LEFT JOIN tbl2 b ON a.Code COLLATE database_default= b.code.
here are some code from each table.
tbl1
300800-92501597,
301000-92501597,
301200-92501597

tbl2
"#1"-1/8" STAMP,
071614-7210256V,
071614-72102580,

thanks

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-02-25 : 11:11:12
It may be because the Code column in tbl1 had a collation that was incompatible with the collation of Code column of tbl2 (which may have had the default collation.) You can see what the collations are using the following queries.
SELECT DATABASEPROPERTYEX('YourDatabaseNameHere','Collation')
SELECT collation_name
FROM sys.columns
WHERE OBJECT_NAME(OBJECT_ID) = 'tbl1'
AND name = 'Code';
Go to Top of Page
   

- Advertisement -