sql server - Query to compare differences of two columns from two different tables -


I am trying to create a union all query, on two different named columns in two different tables

I take the column "Mtrl" in USER_EXCEL and want to compare it against the "short_material_number" column from the IM_EXCEL table. I would then like to return the query difference between only two columns, both columns are home content numbers, but different names (according to column) are given in the tables.

I have so far:

  (select [Mtrl] except selection [short_material_number] dbo.IM_Excel to dbo.USER_EXCEL) UNION ALL (Select [short_material_number] dbo Except IM_Excel [Mtrl] dbo.USER_EXCEL)  

However, when the query I have been asked in an error message that is trying to get:

< Blockquote>

Message 8114, Level 16, State 5, Line 22
Error to change the data type varchar.

After the text "itemprop =" text ">

You are almost certainly getting this error because of your two columns There is a FLOAT data type, while the other VARCHAR is a good place to try to compare the underlying conversion, which may occur when you are the type of data containing two columns Will have to start reading about.

To get this done, you need to convert to a varchar in the boat, as in the example below.

  (select [Mtrl] Select Cast from dbo.USER_EXCEL (VARCHAR (18)) as dbo.IM_Excel ([short_material_number]) Union All (Select Cast ([ Short_material_number] as VARCHAR (18)) Select from Dbo.IM_Excel SELECT [MTRL] to dbo.USER_EXCEL)  

Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

android - how to get distance of 2 beacons and make a condtion base on that distance -

c# - WPF Expander overlay used in ItemsControl -