This must be possible because I believe I've done it before. Here's my query:
这一定是可能的,因为我相信我之前已经做过了。这是我的查询:
insert into exampleFiles Values(NEWID(), cast('c:\filename.zip' as varbinary(max))
Obviously that just inserts the text in between the quotes and not the file from that location. There must be a simple tsql bit of language that I'm forgetting. Thanks
显然,只需在引号之间插入文本,而不是从该位置插入文件。必须有一个我忘记的简单的tsql语言。谢谢
1 个解决方案
#1
21
Does this help?
这有帮助吗?
USE AdventureWorks
GO
CREATE TABLE myTable(FileName nvarchar(60),
FileType nvarchar(60), Document varbinary(max))
GO
INSERT INTO myTable(FileName, FileType, field_varbinary)
SELECT 'Text1.txt' AS FileName,
'.txt' AS FileType,
* FROM OPENROWSET(BULK N'C:\Text1.txt', SINGLE_BLOB) AS Document
GO
Taken from here: http://social.msdn.microsoft.com/Forums/en-US/sqltools/thread/513cbf8c-21a8-4bcc-a565-6eb06437a398
取自这里:http://social.msdn.microsoft.com/Forums/en-US/sqltools/thread/513cbf8c-21a8-4bcc-a565-6eb06437a398
#1
21
Does this help?
这有帮助吗?
USE AdventureWorks
GO
CREATE TABLE myTable(FileName nvarchar(60),
FileType nvarchar(60), Document varbinary(max))
GO
INSERT INTO myTable(FileName, FileType, field_varbinary)
SELECT 'Text1.txt' AS FileName,
'.txt' AS FileType,
* FROM OPENROWSET(BULK N'C:\Text1.txt', SINGLE_BLOB) AS Document
GO
Taken from here: http://social.msdn.microsoft.com/Forums/en-US/sqltools/thread/513cbf8c-21a8-4bcc-a565-6eb06437a398
取自这里:http://social.msdn.microsoft.com/Forums/en-US/sqltools/thread/513cbf8c-21a8-4bcc-a565-6eb06437a398