Change Column Length of file_name in the sys_attachment Table

peterpan
Tera Contributor

Hi,

we have several file to be attached to incidents, changes and or change requests, that have a file name > 100...

When i attach those files to an incident or change or change-request, the file_name is cut at the 100-position.
Changing the Field-Length of the sys_attachment table from 100 to 400 produces the error shown in the picture.

Nevertheless, the Field-Length of the file_name field is extended to 400, it takes no effect on the file_name, it ´s still cut down to 100 characters.
Caused by the cutting of the file name to 100 characters, the file looses its ending (pdf, xls, doc, docx, etc.), and is useless.

My Question is:

How can i extend the field file_name in the sys_attachment table correctly, to have the full file name stored in the DB.

Thank you in advance
woha

4 REPLIES 4

WESAdmin
Kilo Contributor

although this is a very old post I thought I would still post my response incase someone came looking....



I had this same problem and discovered the 100 character limit was set by the dictionary entry on the sys_attachment table, column name = file_name.



by increasing the character limit to 150 it resolved my issue with no errors.   at this point i havent tested what happens if an attachment file name exceeds 150 characters but I'd assume it would do the very same as it did when limited to 100.



Having said that, file attachments are generally named documents or named files.   When I name something I tend to be short and sweet, not write an essay for a file name .





Some of our users have the same problem, namely when they attach a message (.msg) from Outlook with a title having more than 100 caracters.   Although I'm aware of the possibility to increase the value like Wolfgang and Scott suggested, I didn't do it yet.   I won't increase the value to 400 or 500 caracters because I'm afraid of having performance issue or to create a bug elsewhere.   Instead, I've asked the group to pay caution to the 100 caracters limitation when they attach their emails.



Scott: thank you for your response to this post. I'm wondering if your solution of increasing only by 50 caracters resolved the problem and if you had any other impact.



Everybody: anyone found a better way to make sure to keep the file's extension?   I don't mind that the name is cut to 100 caracters, but I would like the file to keep its extension so it can still be opened by clicking on it.


stevedag
Kilo Expert

I open a new thread in the forum to determine if it is possible to cut the length of the file while maintaining the extension.   This way, user will still be able to open the file.   Look for the following title:



"Attachment loses its file extension when length of the filename exceeds the limit."
https://community.servicenow.com/message/736541


Hi,



I ma having a similar issue.. I increased the file_name column max length to 260 on sys_attachment table. In spite of that, my file extension is getting truncated and it is asking for which program to open with when I try opening an attachment.



Thanks,