January 14, 2014 at 9:08 am
Hello All,
I have a sql statement which ends with the lines:
AND P.txtSchoolID NOT IN (SELECT CONTACT.SERIALNUMBER FROM CONTACT)
The problem is P.txtSchoolID is nvchar and contact.serialnumber is varchar so SQL generates a collation conflict error message.
Does anyone know if there is a way of getting around this?
Thanks for any info,
Tony
January 14, 2014 at 9:12 am
Tony
If it's a collation conflict you're suffering from, you can use the COLLATE clause in your query. If the problem is different data types, you can use CAST or CONVERT to convert one column's data to the data type of the other column.
John
January 14, 2014 at 9:35 am
Post the error if you want it more specific.
January 14, 2014 at 11:18 am
tonynlennard (1/14/2014)
AND P.txtSchoolID NOT IN (SELECT CONTACT.SERIALNUMBER FROM CONTACT)The problem is P.txtSchoolID is nvchar and contact.serialnumber is varchar so SQL generates a collation conflict error message.
You can add the desired collation by using the COLLATE statement. You can specify a specific collation or specify the database default collation.
AND P.txtSchoolID collate database_default NOT IN (SELECT CONTACT.SERIALNUMBER collate database_default FROM CONTACT)
January 14, 2014 at 2:32 pm
Hello,
Thank you for everyone's help - the collate statement did the trick.
Tony
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply