如何将图像加载到varbinary列

时间:2012-11-06 20:21:41

标签: sql sql-server-2008 tsql

我有这样的表

CREATE TABLE [dbo].[Product](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [Name] [nvarchar](100) NOT NULL,
    [Description] [nvarchar](max) NOT NULL,
    [Price] [decimal](16, 3) NOT NULL,
    [SmallPhoto] [varbinary](max) NULL);

我想在[SmallPhoto]字段中加载图片

主脚本看起来像这样

declare @filePath varchar(max)
declare @productId int

set @filePath = 'D:\myfile.png'
set @productId = 1

update Product
set SmallPhoto = -- some actions
where Id = @productId

预期结果

命令已成功完成。 :)

UPD:

1)我的数据库位于其他机器

2)我没有机会将文件复制到远程计算机

0 个答案:

没有答案
相关问题