select *, date as calldate,ndnis=cast(dnis as varchar(20))into #targetcallfrom tb_Callswhere DNIS in (1130,1012, 1011, 1139,1131, 1140, 1141,1028,1103) and date>'10/1/2007'--drop table #othercallselect np.*, np.date as calldate, ndnis='All Other DNIS' into #othercallfrom tb_Calls npleft join #targetcall tc on tc.date=np.date and tc.clid=np.clidwhere np.DNIS in (1001,1002,1003,1004,1005,1007) and np.date>'10/1/2007' and tc.clid is null--drop table #allcallselect * into #allcallfrom ( select * from #targetcall union all select * from #othercall) as a
I get error msg from union two tablesMsg 457, Level 16, State 1, Line 1Implicit conversion of varchar value to varchar cannot be performed because the collation of the value is unresolved due to a collation conflict.It seems the Dnis in two tables does not match in type. How can I solve this problem?Thanks.Jeff