sql-scripts icon indicating copy to clipboard operation
sql-scripts copied to clipboard

Error message "String or binary data would be truncated."

Open Crucial2K opened this issue 6 years ago • 0 comments

Hi, I recently got the error "String or binary data would be truncated." while executing dba_indexDefrag_sp . This is because the log, status and exclusion tables (plus some variables) have the type NVARCHAR(128) for columns such as database name, index name etc. being the maximum size allowed for object names. However, if the object name is the maximum 128 characters long a failure will occur with an INSERT using QUOTENAME() because adding square brackets to the name takes the length to 130 characters.

I suggest that the DDL for the tables and variables that are set at NVARCHAR(128) are changed to NVARCHAR(130). Thanks.

Crucial2K avatar Apr 01 '19 09:04 Crucial2K