The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Database field size for storing file paths

What should I set the field size to be for storing a Windows file path? Can the (standard?) 260 path length be exceeded when you are dealing with networked files?
Nick Hebb Send private email
Wednesday, October 17, 2007
Its not very hard to exceed that unfortunately (have done it myself).

Furthermore if your using a db that anyhow just truncates excess data you often won't even hear about the error until later when you try to retrieve the file using the now truncated file pa...
Thursday, October 18, 2007
Actually disregard my reply above.

I think in my case the column was only 255 (rather than 260)? Anyway, if windows limits it to 260 then it would be odd for me to have encountered longer ones and it's more likely I'm getting confused with something else I did that was similar (which indicates I probably don't know what I'm talking about here).
Thursday, October 18, 2007
Christopher Wells Send private email
Thursday, October 18, 2007
We've reset all of our path elements to SQL Server's TEXT type just to account for this. 

AFAIK, the "standard" limit of +/-254 is a Windows(DOS?) thing assuming mapped base locations, so if you're dealing with other filesystems, ftp, or UNC-style paths it ought to be longer than that anyway.
a former big-fiver Send private email
Thursday, October 18, 2007
Yep, I was looking in the file path functions of the Windows API recently, and I'm pretty sure the 260ish length thing isn't actually a limit.  Maybe not since NT, or something like that.
MB Send private email
Thursday, October 18, 2007
Thanks everyone for the replies. I'll use a Text field as suggested.

I admit, I've probably got a MAX_PATH constant in an app or two, so I'll need to change those.
Nick Hebb Send private email
Friday, October 19, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz