简体   繁体   中英

MS SQL temporary table missing field

Why MS-SQL does not throw error in this select? There is no Document_ID field in #aa table.

 CREATE TABLE docs
 (
  Document_ID uniqueidentifier
 )

 SELECT 0x00 Document_XX
 INTO #aa


 SELECT * 
 FROM docs
 WHERE Document_ID IN (SELECT Document_ID FROM #aa)

The Document_ID in SELECT Document_ID FROM #aa would just resolve to the docs.Document_ID

It would be the same as

SELECT * 
FROM docs d
WHERE Document_ID IN (SELECT d.Document_ID FROM #aa)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM