Temple Naylor Temple Naylor - 1 year ago 78
SQL Question

Error of conversion in Microsoft SQL Server

I created a database from the following flow chart: https://www.learncodinganywhere.com/learningmanagementsystem/links/07_DB/SQL_Drill.pdf

I am trying to retrieve the book title, borrower name, and borrower address in my 'Booksville' library branch where the due date is today. I created the following query:

Title, b.[Name], b.[Address] as 'Due Today'
BOOK_LOANS bl ON b.CardNo = bl.CardNo
LIBRARY_BRANCH lb ON lb.BranchId = bl.CardNo
BOOK bk ON bk.BookId = bl.BookId
BranchName = 'Booksville'
AND DueDate = '10-25-2016'

But I get the following error message:

Msg 248, Level 16, State 1, Line 1

The conversion of the varchar value '5397270262193419' overflowed an int column.

Anyone know the solution to this?

Answer Source

Ok there is information enought, but usually you get this error comparing numeric and alphanumeric fields.

I don't know the table schema but it seems there is mistake here:

on lb.BranchId=bl.CardNo

BranchId should match CardNo?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download