1.
Load
data into SQL database from Excel:
FROM OPENROWSET(
BULK 'C:\Documents\MyDoc.docx', SINGLE_BLOB) AS x
-- Update the Fragment
table
UPDATE dbo.Fragments
SET Document= @doc
WHEREID = @ID
sp_configure 'show
advanced options', 1
reconfigure
sp_configure 'Ad Hoc Distributed Queries', 1
reconfigure
SELECT * INTO Link FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel
8.0;Database=E:\data1.xls','SELECT
* FROM [categoryLink$]')
2. Load
Docx file into SQL db table:
Declare a variable to
store the binary data
DECLARE @Doc AS
VARBINARY(MAX)
-- Load the binary data
SELECT @doc =
CAST(bulkcolumn
AS VARBINARY(MAX))FROM OPENROWSET(
BULK 'C:\Documents\MyDoc.docx', SINGLE_BLOB) AS x
UPDATE dbo.Fragments
SET Document= @doc
WHEREID = @ID
No comments:
Post a Comment