Sql-server:引用SQL表中的文件 [英] Sql-server: reference to files in a SQL table

查看:89
本文介绍了Sql-server:引用SQL表中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个SQL表来存储有关发送给客户的文档的信息。





I have a SQL table to store information about documents that where sent to customers.

Table

timestamp [datetime2(0)]
customerID [nvarchar(50)]
fileOk [bit]
folder [nvarchar(max)]
file1 [nvarchar(255)]





示例



Example

timestamp            customerID    fileOk    folder         file1
2018-08-13 14:20:00  C920987238    1         /docFolder/    customerdoc1.pdf





该表包含大约100.000行。

有没有办法将表绑定到现有目录?

假设我删除文件夹中的文件fileOk自动设置为0?

或者如果我在文件夹中添加了一个新的默认条目?



我尝试了什么:



使用自定义脚本(C#)完成工作。



The table consists of some 100.000 rows.
Is there a way to bind the table to an existing directory?
Say I delete a file in the folder the field fileOk is autmatically set to 0?
Or if I add a file to the folder an new default entry is created?

What I have tried:

Used a custom script (C#) which does the job.

推荐答案

我所知道的唯一本机SQL Server功能将实现一个FileTable,它将在本地文件系统中创建一个目录来存放文件。

标准文件系统进程与SQL中的表是原子的,然后触发器可用于更新您当前的表格。



文档:

将文件加载到FileTable [ ^ ]

FileTables - 触发兼容性 [ ^ ]



我个人会坚持使用编程代码解决方案。
The only native SQL Server functionally that I am aware of would be to implement a FileTable, which would create a directory in the local file system to house the files.
Standard file system processes would be atomic with the table within SQL, and then triggers could be utilized to update your current table.

Documentation:
Load files into FileTable[^]
FileTables- Trigger Compatability[^]

I personally would stick with a programming code solution.


这篇关于Sql-server:引用SQL表中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆