解决sql脚本执行中遇到 The multi-part identifier "xxx" could not be bound. 的问题

时间:2025-02-15 08:23:07

在运行sql脚本时,突然报了The multi-part identifier "xxx" could not be bound.的错误,仔细查看后发现是因为选择字段时用了替代符号,但是from 表名后面没有加替代符b,就是如下情况:
 

select ,
from 表名
where .....

实际上应该写成如下格式:

select ,
from 表名 b
where .....

重点就是表名后面的 b 没加。
目前仅在sql server中碰到这个问题,做个记录