本文介绍了SQL Server 2008 R2的数据库错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 大家好 这是我的选择语句的存储过程 CREATE PROCEDURE [dbo]。[uspStudentEquipment] @ studentNumber nvarchar ( 50 ) AS BEGIN SELECT EquipmentName,EquipmentModel,Description,[Equipment Type Id],DateInRoom,TimeInRoom FROM 设备 WHERE Equipment.StudentNumber = Student.StudentNumber AND Equipment.StudentNumber=@studentNumber END GO - 当我执行此存储过程时,我得到了这个错误essage: Msg 4104,Level 16,State 1,Procedure uspStudentEquipment,Line 12 多部分标识符Student.StudentNumber无法绑定。 我不太清楚这个错误意味着什么。有人可以帮忙吗? 谢谢解决方案 您忘了在查询中添加表学生。 br /> SELECT EquipmentName,EquipmentModel,Description,[Equipment Type Id],DateInRoom,TimeInRoom FROM 设备, 学生 WHERE Equipment.StudentNumber = Student.StudentNumber AND Equipment.StudentNumber=@studentNumber CREATE PROCEDURE [dbo]。[uspStudentEquipment ] @ studentNumber nvarchar ( 50 ) AS BEGIN SELECT EquipmentName,EquipmentModel,Description,[Equipment Type Id],DateInRoom,TimeInRoom FROM 设备 WHERE Equipment.StudentNumber=@studentNumber END GO 试试这个 你可以这样做,它会解决你的要求 CREATE 程序 [dbo]。[uspStudentEquipment] @ studentNumber nvarchar ( 50 ) AS BEGIN 从选择 * ( SELECT EquipmentName,EquipmentModel,Description,[Equipment Type Id],DateInRoom,TimeInRoom FROM 设备,学生 WHERE Equipment.StudentNumber = Student.StudentNumber ) as x 其中 x.StudentNumber=@studentNumber END GO 问候 Mubin Hi allHere's my stored procedure for a select statementCREATE PROCEDURE [dbo].[uspStudentEquipment]@studentNumber nvarchar (50)ASBEGINSELECT EquipmentName,EquipmentModel,Description,[Equipment Type Id],DateInRoom,TimeInRoomFROM Equipment WHERE Equipment.StudentNumber = Student.StudentNumber AND Equipment.StudentNumber=@studentNumberENDGO-When I execute this stored procedure i get this error message:Msg 4104, Level 16, State 1, Procedure uspStudentEquipment, Line 12The multi-part identifier "Student.StudentNumber" could not be bound.I am not too sure what this error means. Could anyone please help?Thanks 解决方案 You forgot to add the table Student in your query.SELECT EquipmentName,EquipmentModel,Description,[Equipment Type Id],DateInRoom,TimeInRoom FROM Equipment, Student WHERE Equipment.StudentNumber = Student.StudentNumber AND Equipment.StudentNumber=@studentNumberCREATE PROCEDURE [dbo].[uspStudentEquipment]@studentNumber nvarchar (50)ASBEGIN SELECT EquipmentName,EquipmentModel,Description,[Equipment Type Id],DateInRoom,TimeInRoom FROM Equipment WHERE Equipment.StudentNumber=@studentNumberENDGOtry thisHi,You can go for this, it will solve your requirementCREATE PROCEDURE [dbo].[uspStudentEquipment]@studentNumber nvarchar (50)ASBEGINselect * from (SELECT EquipmentName,EquipmentModel,Description,[Equipment Type Id],DateInRoom,TimeInRoomFROM Equipment,studentWHERE Equipment.StudentNumber = Student.StudentNumber )as x where x.StudentNumber=@studentNumberENDGORegardsMubin 这篇关于SQL Server 2008 R2的数据库错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-20 22:25