下列查詢會傳回儲存在類型數據行中的 varbinary(max) 產品相片。 在 BINARY BASE64 查詢中指定 選項,以傳回base64編碼格式的二進位數據。
範例
USE AdventureWorks2012;
GO
SELECT ProductPhotoID, ThumbNailPhoto
FROM Production.ProductPhoto
WHERE ProductPhotoID=1
FOR XML RAW, BINARY BASE64 ;
GO
以下是結果:
<row ProductModelID="1" ThumbNailPhoto="base64 encoded binary data"/>