Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 88061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:30:02+00:00 2026-05-10T22:30:02+00:00

I have a MS SQL DB with various tables, and one field in particular

  • 0

I have a MS SQL DB with various tables, and one field in particular is causing me grief.

The Data type is set to varchar(100), however the field is limited to 60 characters.

If I try to put any string with more than 60 characters into the field I get an exception, ‘String or binary data would be truncated’. Although the string is shorter than the explicitly set data type, it still throws an exception.

Is there perhaps a DB setting that does this? What could cause the explicitly set data type to be overwritten?

Edit:
The triggers do not copy the value or insert it into another table and they don’t use the data either. – (Incorrect)

Strings that are smaller than 60 chars work fine.

All the columns that have varchar(100) give the same problem, but all the other columns accept correct values. The varchar(10) column works fine.

Any row in this table throws the exception if I try to update the field with a string longer than 60 chars.

I am trying to insert the data directly into the field using SQL Server Management Studio.

There is no padding involved.

Answer:

There was a second table where the column was set to 60. The update trigger called a stored Procedure that inserts the data into the ‘Denormalised’ table.

Thanks for all the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:30:03+00:00Added an answer on May 10, 2026 at 10:30 pm

    What does the metadata function COL_LENGTH say is the defined size of that column?

    Do you have any default length constraint on that column?

    Assuming from the previous answers that this is not a trigger problem or an nvarchar issue, and you think the truncation is at length 60, what does updating that single column with SUBSTRING of length 60 and then 61 do? This could validate or invalidate your theory.

    Alternatively it’s possible that the database collation and/or encoding settings have changed since the original data was inserted. This can lead to some peculiarities. You say this is a copy of the original database. Is it sitting on a different SQL Server instance? If so, do both SQL Server instances have the same collation and encoding settings?

    EDIT: Use of the ANSI_PADDING setting that you discuss is deprecated, and the setting will be permanently ON in future versions of SQL Server. But the fact that you’re looking at this suggests that the value you’re trying to insert is padded in some way, perhaps with trailing blanks. However, this isn’t consistent with your SUBSTRING experiment results, which shows a cut-off at 60 characters. So I’m not sure if this setting is relevant, especially as it is always ON for a nvarchar column.

    Does any string of 61 characters cause the update exception? Also, although you’ve checked the immediate table triggers, are there any cascaded (indirect) triggers that might be causing this exception?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.