CREATE TABLE #BlobData(BlobData image)
declare @file nvarchar(50)
declare @sql nvarchar(1000)
set @file = 'd:/vss2005.iso'
--insert blob into temp table
SET @sql =
N'
INSERT INTO #BlobData
SELECT BlobData.*
FROM OPENROWSET
(BULK ''' + @file + ''', SINGLE_BLOB) BlobData'
EXEC sp_executesql @sql
--update
-- UPDATE dbo.DBBACK
-- SET bakfile = (SELECT BlobData FROM #BlobData)
--
-- DROP TABLE #BlobData
insert into DBBACK SELECT BlobData FROM #BlobData
drop table #BlobData
GO
-----------------实际使用
--630M需要2分44秒,视网络情况而定
--select @@version
--xp_msver
CREATE TABLE #BlobData(BlobData image)
declare @file nvarchar(50)
declare @sql nvarchar(1000)
set @file = 'd:/aaa.xls'
--insert blob into temp table
SET @sql =
N'
INSERT INTO #BlobData
SELECT BlobData.*
FROM OPENROWSET
(BULK ''' + @file + ''', SINGLE_BLOB) BlobData'
EXEC sp_executesql @sql
insert into X_RemoteBak SELECT 'test', BlobData FROM #BlobData
drop table #BlobData
GO
CREATE TABLE [dbo].[X_RemoteBak](
[id] [int] IDENTITY(1,1) NOT NULL,
[dbname] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
[dbcontent] [image] NULL)