换句话说,我可以这样说:
MERGE MyTable AS trg
USING (VALUES(1, 'a')) AS src(key, val)
ON ...
我也希望能够这样说:
-- does not work:
MERGE MyTable AS trg
USING () AS SRC(key, val)
ON ...
有办法做到这一点吗?除了MERGE,FROM等文档中的切向引用之外,我似乎找不到关于派生表(Sql Server 2008R2)的更多官方文档。
答案 0 :(得分:1)
是的,通过使用永远不会将任何行作为派生表返回的查询:
USING (SELECT 1 as 'key', 1 as 'val' where 1 = 0) AS src (key, val)