programing

SQL Server의 이미지 필드 컨텐츠 크기는 어떻게 됩니까?

bestprogram 2023. 9. 9. 09:46

SQL Server의 이미지 필드 컨텐츠 크기는 어떻게 됩니까?

SQL Server에 테이블이 있습니다.이 테이블에는 이미지 필드가 있으며 응용프로그램은 그 안에 파일을 저장합니다.

T-SQL을 이용하여 이미지 필드의 파일 크기를 읽을 수 있는 방법이 있습니까?

SELECT DATALENGTH(imagecol) FROM  table

MSDN 참조

다양한 디스플레이 스타일:

SELECT DATALENGTH(imagecol) as imgBytes,
       DATALENGTH(imagecol) / 1024 as imgKbRounded,
       DATALENGTH(imagecol) / 1024.0 as imgKb,      
       DATALENGTH(imagecol) / 1024 / 1024 as imgMbRounded,
       DATALENGTH(imagecol) / 1024.0 / 1024.0 as imgMb
FROM   table

출력 예시:

imgBytes    imgKbRounded    imgKb       imgMbRounded    imgMb
68514       66              66.908203   0               0.065340041992

언급URL : https://stackoverflow.com/questions/10019438/what-is-the-size-of-a-image-field-content-in-sql-server