将两列与 SQL Server 2008 中其他 table 的列进行连接和比较?

Concatenate and compare two columns with column from other table in SQL Server 2008?

我得到了一个设计糟糕的数据库。格式如“1.03.3”的密钥粘在 table T1 的描述上,类似于“1.03.3 计算机价格”。

我正在构建一个单独的 table T2,其中键“1.03.3”与描述 "Prices for computers" 在一列中分开。

我想构建一个查询,将 T1 中的适当值与 T2 中的两个字段进行比较,例如:

T1.field1 = concat(T2.key + ' ' + T2.description)

如果找到匹配项,则将 T2 中的完整行插入到另一个 table T3。

我不确定如何在 SQL Server 2008 中的 TSQL 中执行此操作。 有人可以举一个例子,将两个粘合的列与另一个 table 的列进行比较吗?

使用 concat()+ 是多余的,所以:

T1.field1 =  (T2.key + ' ' + T2.description)

concat() 无论如何在 SQL Server 2008 中不可用。

完整的查询类似于:

select t2.*
into t3
from t2 join
     t1
     on t1.field1 =  (t1.key + ' ' + t2.description);

如果 t3 已经存在,请使用 insert 而不是 select into