ERROR: CASE types character varying and numeric cannot be matched

All the branches of a case expression should return the same datatype. One way to achieve that is to explicitly cast where needed: ,(case when all_loc.country = ‘DE’ then msc_si.buyer_id::varchar else msc_si.buyer_name end) as “purchasing_group_name_buyer_name” — Here ———————————————–^ ,(case when all_loc.country = ‘DE’ then msc_si.planner_code::varchar else mscp.description end) as “mrp_controller_name” — And here ———————————————–^

T-SQL INSERT INTO with LEFT JOIN

You want insert into . . . select: INSERT INTO [DB_A].[dbo.a_test](a,b,c,d,e) –ADDED A COLUMN select p.product_info, p.product_date, p.smth, pr.program_name, pr.program_smth FROM [DB_B].dbo.products p LEFT JOIN [DB_B].dbo.program pr ON p.program_name = pr.product_info; I also fixed the query to use table aliases, so it is much easier to read.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)