Issue with a View that worked and now it doesnt....

Moordoom

Member
Joined
Nov 12, 2013
Messages
23
Programming Experience
1-3
I have an issue with a view that worked and now suddenly it does not.

VB.NET:
SELECT c2.name, c2.cust_num from custaddr as c2 INNER JOIN co as c1 ON (c2.cust_num = c1.cust_num) INNER JOIN shipper_sii as s1 on (c1.co_num = s1.co_num) WHERE c2.cust_seq = 0 AND lot = '" & Carton1 & "'

It should display name and cust_num from the table custaddr, but it doesn't pull any data.
I have even substituted a actual carton number for the variable Carton1
The view runs without error and displays the correct header, just no data.
The only exception is if I substitute the '" & Carton1 & "' with 4000545398 which is the last carton number entered to the FIRST cust_num that is alpha (not numeric).

All columns selected in the view are nvarchar of equal lengths.
co_num in Shipper_sii and co are nvarchar (7)
cust_num in custaddr and co are nvarchar (10)
name in custaddr is nvarchar (50)

Anyone have any ideas?
 
Ok, a little more information...
Column lot is a nvarchar(15)
Before when this view worked, the lot numbers we 8 digits like 10178113.
We closed a plant and added the closed plants customers and cartons to our database, and several of the lot numbers are like 4000545398 (10 digit).
If I now substitute an 8 digit lot number in the View for '" & Carton1 & "', I get a error "The conversion of the nvarchar value ' 4000545398' overflowed an int column. Maximum integer value exceeded."
In the error it is displaying 4 white spaces in front of the lot number. Could that be the cause?
 
Back
Top