.net - Handling file size for SQL FILESTREAM data -


what proper way handle file sizes when using sql server's filestream feature store documents in database?

i know can use tsql command datalength() on filestream column, regarding this microsoft article might not best idea:

avoid retrieving data length of lots of blob files in application. time-consuming operation because size not stored in sql server database engine. if must determine length of blob file, use transact-sql datalength() function determine size of blob if closed. datalength() not open blob file determine size.

i bit unclear if above says should avoid datalength() if possible or if recommended way retrieve file size.

if have access document sizes show user metadata, recommended way retrieve them? store them in separate field? or datalength() fast enough?

i believe article suggesting not use datalength() if can avoided.

storing file size in separate column suitable alternative, along other metadata files (content type, extension, timestamp, etc). allow query/filter file details more efficiently.

if file contents not expected change, updating filesize column while persisting filestream data simplest.

if contents expected change, need remember update file size well. can accomplished in sql persisted computed column


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -