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
 Error Message

Author  Topic 

rds207
Posting Yak Master

198 Posts

Posted - 2010-06-09 : 17:51:57
Hi
I am selecting data from 2 tables , the join condition i can have is on two different datatype coloumns, but the data in both the columns is same...

I get this error for below statement,


"The data types text and nvarchar are incompatible in the equal to operator."

Here is my statement


select a.Jobname,b.EC_JOB_NAME,((a.ByteCount)/1024)
from a,b where a.Jobname = b.EC_JOB_NAME
and a.Action='COPY'


The datatype of Jobname is text and datatype of ec_job_name is nvarchar, i dont have the control to change the datatypes of these columns , how do i handle this...

Please Help

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-10 : 01:30:34
Here you can see that text can be converted to varchar:
http://msdn.microsoft.com/de-de/library/ms187928.aspx

So try this:
where convert(varchar(max),a.Jobname) = b.EC_JOB_NAME


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -