July 4, 2005 at 3:36 pm
I'm having trouble with the following phrase:
Server: Msg 8152, Level 16, State 4, Line 1
String or binary data would be truncated.
The statement has been terminated.
(0 row(s) affected)
Not sure what to do. VERY much a SQL Newbie (Please, Please, anyone that can help?!?) I just need help finding out how to fix the "string or binary data would be truncated" part. Thank you!
Here is my code:
USE Northwind
GO
CREATE VIEW SpainView
AS
SELECT OrderID, ShipCountry
FROM Orders
WHERE ShipCountry = 'Spain'
GO
UPDATE SpainView
SET ShipCountry = 'DestinationSpain'
WHERE ShipCountry = 'Spain'
DELETE FROM SpainView WHERE ShipCountry!= 'Spain'
GO
July 4, 2005 at 4:16 pm
From the information you've posted I'd say the length of the ShipCountry field is shorter than the data you want to put into it. "DestinationSpain" is 16 chars long so the ShipCountry field will need to be a varchar or char field that is 16 chars or longer.
--------------------
Colt 45 - the original point and click interface
July 4, 2005 at 4:47 pm
Ok, thank you, I'll fix that and see how it goes.
Thanks again, Phill,
Lilly
July 14, 2005 at 11:23 am
SET ANSI_WARNINGS OFF
...
Your query
..
SET ANSI_WARNINGS ON
Moe C
July 14, 2005 at 5:33 pm
And this fixes the data truncation how ??
--------------------
Colt 45 - the original point and click interface
July 14, 2005 at 5:45 pm
It does not fix it but if the fields are correct in length and you still getting the same error message for what ever reason, I have use this code to stop giving me those error messages because i have combed through all the characters in that field and they do not exceed varchar(50) ...
Moe C
July 14, 2005 at 6:29 pm
??? where does varchar(50) come into it? I don't recall seeing where the poster mentioned anything about field definitions. Are you working on some other problem?
--------------------
Colt 45 - the original point and click interface
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy