Sql server 将SQL查询从DB2迁移到SQL Server
我正在致力于将SQL代码从DB2迁移到SQL Server 2012,我是SQL Server的新手,并且一直坚持这个DB2查询:Sql server 将SQL查询从DB2迁移到SQL Server,sql-server,Sql Server,我正在致力于将SQL代码从DB2迁移到SQL Server 2012,我是SQL Server的新手,并且一直坚持这个DB2查询: select * from schema.tablename1 t1 where (t1.column1,t1.column2) in (select t2.column1,t2.column2 from schema.tablename2 t2) 如何在SQL Server中执行相同的操作?您可以使用EXISTS SELECT * FROM schem
select * from schema.tablename1 t1
where (t1.column1,t1.column2)
in
(select t2.column1,t2.column2 from
schema.tablename2 t2)
如何在SQL Server中执行相同的操作?您可以使用
EXISTS
SELECT *
FROM schema.tablename1 t1
WHERE EXISTS (SELECT *
FROM schema.tablename2 t2
WHERE t1.column1 = t2.column1
AND t1.column2 = t2.column2)
尝试迁移查询时是否遇到错误?请同时提供这些信息。@NickRoth-SQL Server不支持在中使用
的元组/行构造函数。只能执行WHERE col1 IN(选择一些列…
而不是多列。