TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
275.4k
Conversion failed when converting the nvarchar value '/' to
Jun 4 2018 9:07 PM
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 .
Reply
Answers (
3
)
specification and implementation of the abstract data type.
Insert a Column