IF OBJECT_ID ('file_table', 'U') IS NOT NULL
DROP TABLE file_table;
GO
CREATE TABLE file_table(FileName nvarchar(60), FileType nvarchar(60), Document varbinary(max))
GO
INSERT INTO file_table(FileName, FileType, Document)
SELECT 'myText.txt' AS 文件名, '.txt' AS 文件类型, *
FROM OPENROWSET(BULK 'C:/myText.txt', SINGLE_BLOB) AS Document
INSERT INTO file_table(FileName, FileType, Document)
SELECT 'Img252837387.jpg' AS 文件名, '.jpg' AS 文件类型, *
FROM OPENROWSET(BULK 'C:/Img252837387.jpg', SINGLE_BLOB) AS Document
INSERT INTO file_table(FileName, FileType, Document)
SELECT '1.rar' AS 文件名, '.rar' AS 文件类型, *
FROM OPENROWSET(BULK 'C:/1.rar', SINGLE_BLOB) AS Document
GO