I have SQL query as following :
SELECT TOP (99.9999999) PERCENT CAST(CAST(LEFT(SpecialCode, CHARINDEX('/', SpecialCode) - 1) AS NVARCHAR) AS INT) AS Expr1
,CAST(CAST(RIGHT(SpecialCode, CHARINDEX('/', SpecialCode) - 6) AS NVARCHAR) AS INT) AS Expr2
,MemberCode ,SpecialCode ,StartingDate ,JoinDate
,EndDate ,BirthDate ,NAME ,FirstName
,MiddleName ,LastName ,Nationality ,Nationality2
,Education ,Address ,City ,Country ,PostalCode
,Homephone1 ,Homephone2 ,Workaddress ,WorkPhone1
,Ext1 ,WorkPhone2 ,Ext2 ,Mobile1 ,Mobile2
,FaxNumber ,Email ,EmergencyTel ,NoOfYearsTennis
,ClubName ,NationalRank ,Year ,class ,NoOfYearsTournament
,Note ,MSRelation ,RelatedMemberCode ,MScategory
,Member ,ParentCard1 ,ParentCard2 ,ExpDate ,position
,worktype ,NonActive ,MSKind ,MSType ,CardNumber
,CardReceived ,Discount ,Religious ,Gender ,Organization
,RelatedMemberCodeOld ,CreateUserId ,CreateDateAndTime ,UserId
,DateAndTime ,HasNotEmail ,VillaOwner ,Homephone3 ,Mobile3
,Email2 ,Email3 ,BirthPlace ,NationalNo ,EndDateNationalNo
,MiritialStatusID ,WifeNo ,GeneralAssembly
FROM dbo.Members
WHERE (Member = 1)
AND (SpecialCode IS NOT NULL)
ORDER BY expr1
,EXPR2
Field SpecialCode found in Members Table and have values like that
006403/1 when i run query above it give me error
Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the nvarchar value '/' to data type int.
why and how to solve this error .
What I have tried:
Conversion failed when converting the nvarchar value '/' to data type int.