开发者

The multi-part identifier "ocl.id_Project" could not be bound

This is my stored procedure :

ALTER procedure [dbo].[GetProjectDetails]
@id_Project varchar(50),
@Flag varchar(50)
as

set nocount on;

if @Flag='0'
begin
--distinct
select oci.id_Project, cm.Project_Name, 
    (select Project_Na开发者_运维百科me from tp_Project_Master mc where mc.id_Project=oci.id_Project) as Project_Name, oci.Thumbnail_Image 
    from tp_Project_Master cm, tp_Project_images oci  
    where cm.id_Project=ocl.id_Project and oci.syncoperation<>'D' and oci.isdefault=1 order by oci.dateadded desc
end

But I am getting this error :

Msg 4104, Level 16, State 1, Procedure GetProjectDetails, Line 13
The multi-part identifier "ocl.id_Project" could not be bound.

I can't work out why I'm getting this error.


You don't have an object named ocl (ocl is mentioned in your where clause). You do have an object named oci. I'm guessing its just a typo.


Because you're using oci to refer to the table, not ocl. Change this line and it should work:

where cm.id_Project=oci.id_Project
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜