SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 COLLATE database_default
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kt
Yak Posting Veteran

75 Posts

Posted - 02/25/2013 :  10:41:29  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

3326 Posts

Posted - 02/25/2013 :  11:11:12  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000