0
 INSERT INTO [CVSUAT].[dbo].[UserLevel ]( 
  [Client_ID]
  ,[User_Level_Name]
  ,[User_Level_Description]
  ,[Created_by]
  ,[Created_Date]
  ,[Modified_by]
  ,[Modified_Date]
  ,[Delete_Flag]
  ,[Deactivate_Flag]) VALUES ('sndbsndbsdnbsndbsnbdnsbdn23','Client','','Client','2013-03-12 21:31:38.437','Client','2013-03-12 21:31:38.437','0','0')

Msg 8152, Level 16, State 4, Line 1 String or binary data would be truncated. The statement has been terminated.

enter image description here

NOTE: My Table has a space [UserLevel ] as it was made that way from before

5
  • 4
    get rid of that fricking trailing space! That's ridiculous. Talk about technical debt! Commented Feb 6, 2013 at 9:38
  • 1
    Is User_Level_ID an identity column? Also just a side note, Delete-Flag and Deactivate_Flag sounds like they should be BIT columns. Commented Feb 6, 2013 at 9:38
  • As all of your columns are nullable (except the PK), why are you entering empty string into some of them for unknown values? You could have just not inserted into them at all, and left them as null. Commented Feb 6, 2013 at 9:52
  • 1
    What's the bet, that that trailing space is still there in 5 years time... Commented Feb 6, 2013 at 12:19
  • @MitchWheat You're assuming the company lasts that long ;-) Commented Feb 6, 2013 at 15:23

1 Answer 1

1

This is caused by attempting to put too much data into a column.

The trouble is, none of the values specified in your example are too large for the columns indicated in your schema picture. I'd therefore assume that the values you've given us either aren't the true values, or you've got a trigger on that table, which is actually what is causing the error.

As an aside, shouldn't your Delete_Flag and Deactivate_Flag columns be of datatype bit, rather than char(1)?

Edit:

Oh, and one more thing - as Client_ID is an nvarchar, you probably want to store unicode data in there. To indicate this in your script, you should use the "N" prefix on your strings, like so:

INSERT INTO [CVSUAT].[dbo].[UserLevel ]( 
  [Client_ID]
  ,[User_Level_Name]
  ,[User_Level_Description]
  ,[Created_by]
  ,[Created_Date]
  ,[Modified_by]
  ,[Modified_Date]
  ,[Delete_Flag]
  ,[Deactivate_Flag]) VALUES (N'sndbsndbsdnbsndbsnbdnsbdn23','Client','','Client','2013-03-12 21:31:38.437','Client','2013-03-12 21:31:38.437','0','0')
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.