将Word Docx添加为默认值

发布于 2025-01-31 18:03:37 字数 823 浏览 3 评论 0原文

我想默认情况下将MS Word文档(DOCX)存储在SQL Server中。到目前为止,我已经能够做的是在SQL Server中创建一个Varbinary(Max)列,通过MS Access链接到此表,并通过MS Access将Word Document链接到本列中(在访问中,它作为Ole Object列出现)。这很棒,并且成功保存/上传文件,但理想情况下,我希望这些文档默认情况下或创建记录时。我希望这很清楚。

这是我尝试的...

我尝试通过MS Access添加此文档(如上所述)。这很好。我在此列中复制了斑点文本(下面的0x0151 ...文本),并创建了以下相反:

ALTER TABLE [dbo].[CM_PROJECTS] ADD  CONSTRAINT [DF_CM_PROJECTS_ATTACHMENT]  DEFAULT (0x0151...D2CC72D) FOR [CM_DOCUMENTATION]

这似乎在SQL Server中起作用。更具体地说,当我将记录添加到CM_Projects时,当我在SSM中查询表格时,CM_Documentation列中有此斑点。但是,在MS Access中,当我尝试查看该字段的内容时,我什么都没有得到。该字段在MS访问中为空白(我尝试刷新)。

我还尝试了此 thread 对Alter命令(如上所述)很好。我一直遇到语法错误。

有什么想法吗?

I would like to store MS Word documents (docx) in SQL Server by default. What I have been able to do so far is create a varbinary(max) column in SQL Server, link to this table via MS Access, and drag Word documents into this column via MS Access (in Access it is coming up as OLE Object column). This is great and the files were saved/uploaded successfully, but ideally I would like these documents in this table by default, or when the record is created. I hope that's clear.

Here is what I've tried...

I tried to add this document via MS Access (as mentioned above). This worked fine. I copied the blob text in this column (the 0x0151... text below), and created the following contraint:

ALTER TABLE [dbo].[CM_PROJECTS] ADD  CONSTRAINT [DF_CM_PROJECTS_ATTACHMENT]  DEFAULT (0x0151...D2CC72D) FOR [CM_DOCUMENTATION]

This seems to work in SQL Server. More specifically, when I add a record to CM_PROJECTS, the CM_DOCUMENTATION column has this blob in there when I query the table in SSMS. However in MS Access, when I try to see the contents of this field, I get nothing. The field is blank in MS Access (I tried to refresh).

I also tried what was mentioned in this thread, but this didn't play nice with the ALTER command (as above). I kept getting syntax errors.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文