+' delete m from '+@strDBName +'.dbo.m_device as m where not exists '
+' (select 1 from @tmpDevice where nodeid = m.nodeid) '
上面终于面表了,怎样在mssql的delete用用到被delete的表的别名
如果不用别名会写成下面那么复杂
+' delete from '+@strDBName +'.dbo.m_device where nodeid in '
+' (select nodeid from '+@strDBName +'.dbo.m_device as m'
+' where not exists(select 1 from @tmpDevice where nodeid = m.nodeid) )'