Here I will explain how to solve the problem of “string or binary data would be truncated. The statement has been terminated.” in sql server.
Description:
One day I am trying to insert data into one table using SQL queries at that time I got error like “String or binary data would be truncated. The statement has been terminated.” Actually this problem because of I declared column datatype varchar(25) but I am inserting data more than 25 characters in that column. To solve this problem I modified column datatype varcha (25) to varchar(50)
DECLARE @UserDetails TABLE(UserId INT, UserName VARCHAR(25),Designation VARCHAR(10))
INSERT INTO
@UserDetails(UserId,UserName,Designation)
VALUES(1,'Suresh
Dasari','Senior
Software Engineer')
SELECT * FROM @UserDetails
|
Msg 8152, Level 16, State 14, Line
2
String or binary data would be
truncated.
The statement has been terminated.
(0 row(s) affected)
|
DECLARE @UserDetails TABLE(UserId INT, UserName VARCHAR(25),Designation VARCHAR(50))
INSERT INTO
@UserDetails(UserId,UserName,Designation)
VALUES(1,'Suresh
Dasari','Senior
Software Engineer')
SELECT * FROM @UserDetails
|
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|

Subscribe by RSS
Subscribe by Email
3 comments :
gud one...
Thanks a lot for sharing.
YOU SAVED MY TONS OF TIME..... THANK YOU