无法将图像数据类型选为DISTINCT,因为它无法比较

时间:2015-12-31 04:20:21

标签: sql-server vb.net sql-server-2008-r2

我想选择DISTINCT StudentID或记录,但查询显示以下错误

  

不能将图像数据类型选为DISTINCT,因为它不是   可比

enter image description here

数据库关系 enter image description here

这是我的代码:

ALTER PROCEDURE [dbo].[uspSELECTALL]


AS
BEGIN

    SET NOCOUNT ON;

    SELECT  DISTINCT(SI.StudentID),SI.Surname,SI.FirstName,SI.MiddleName, SI.StudAddress , 
            SI.BirthDay,SI.Gender, SI.Nationality, SI.BirthPlace,
            SI.TelNum,SI.SchoolWhereGraduated , 
            SI.DatesWhenGraduated, SI.SchoolLastAttended,
            SI.Note,SI.StudImage,
            PI.Father_FirstName,PI.Father_LastName,
            PI.Father_MI,PI.Father_Occupation, 
            PI.Father_TelNUm, PI.Mother_FirstName, PI.Mother_LastName,
            PI.Mother_MI,PI.Mother_Occupation,PI.Mother_TelNum,
            PI.Contact_FirstName,PI.Contact_LastName,PI.Contact_MI,
            PI.Contact_Mobile,PI.Contact_TelNum,PI.Contact_Address,
            SH.SchoolYear,SH.Levels,SH.Section,SH.DateEnrolled

            FROM StudentInformation SI 
            JOIN StudentHistory SH  
                ON SI.StudentID = SH.StudentID
            JOIN ParentInformation PI
                ON PI.ParentID = SI.ParentID


END

1 个答案:

答案 0 :(得分:2)

将图片转换为varbinary。然后,您就可以申请DISTINCT