Sql 71501 Error

Zeeshan Haider 21 Reputation points
2020-09-07T05:23:46.44+00:00

This is the error i am facing for one week.
I don't know how to solve it :

SQL71501 :: Procedure: [dbo].[st_feesdata] contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: [dbo].[allstudents].[Remaining] or [dbo].[st_fees].[Remaining].

and the procedure is :
ALTER procedure [dbo].[st_feesdata]
@Roll_No int
as
SELECT allstudents.Roll_No,allstudents.Name,allstudents.Course,allstudents.Fees,st_fees.Remaining
from allstudents left join st_fees on allstudents.Roll_No = st_fees.Roll_No left join st_fees as s on allstudents.Remaining = s.Remaining
where allstudents.Roll_No = @Roll_No order by Remaining ASC

I don't Know whats wrong with this procedure.
I have created the above procedure in SSMS it doesn't show any error but when i wanted to update my table on visual studio it shows that error 7501.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,999 questions
0 comments No comments
{count} votes

Accepted answer
  1. Olaf Helper 45,106 Reputation points
    2020-09-07T06:34:53.18+00:00

    objects: [dbo].[allstudents].[Remaining] or [dbo].[st_fees].[Remaining].

    As the error message says, one of the column don't exists.

    In the ORDER BY clause you address the column "Remaining" without specifying for with table; by the rest of you code the column exists in at least 2 of the tables; so you have to specify the table name.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.