Click here to Skip to main content
15,908,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
ALTER PROCEDURE Ins2(@id   INT,@name NVARCHAR(50)) 
AS 
  BEGIN 
      BEGIN try 
          INSERT INTO abc 
                      (id, 
                       name) 
          VALUES     (@id, 
                      @name) 
      END try 

      BEGIN catch 
          INSERT INTO exception 
          VALUES      (Error_number(), 
                       Error_severity(), 
                       Error_state(), 
                       Error_procedure(), 
                       Error_line(), 
                       Error_message(), 
                       Getdate()) 

          SELECT * 
          FROM   exception 
      END catch 
  END 



ERROR:

(0 row(s) affected)
Msg 8152, Level 16, State 13, Procedure ins2, Line 19
String or binary data would be truncated.
The statement has been terminated.
.......
Posted
Updated 27-Aug-14 22:50pm
v2
Comments
[no name] 28-Aug-14 4:03am    
Check the size of the fields that you are trying to insert data into. One of them is too small.

1 solution

Hi,


Check the size of Varchar data type fields with data length.


Cheers
 
Share this answer
 
Comments
thangaraj kathiravan 28-Aug-14 5:38am    
thank you..now i got output..i made the changes in varchar datatye.
Magic Wonder 28-Aug-14 5:39am    
Your welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900