如何在 SQL Server 2008 存储过程中读取配置文件键 [英] How to read config file key in SQL Server 2008 stored procedure
本文介绍了如何在 SQL Server 2008 存储过程中读取配置文件键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的 c://config
settings.config
有以下内容:
<filelocation>d://mydata</filelocation>
现在我想在我的 SQL Server 2008 存储过程中获取 d://mydata
文件路径,它将把这个位置作为文件创建路径的输入.
Now I want to get d://mydata
file path in my SQL Server 2008 stored procedure, which will take this location as input for file creation path.
请推荐!!
推荐答案
简化示例,但您可以执行以下操作(假设您可以从 SQL Server 读取文件):
Simplified example but you could do something like this (assuming you can read the file from SQL Server):
declare @table table (Value XML)
insert @table
select a.* from openrowset (bulk 'C:\config', single_clob) a
select * from @table
select Value.value('filelocation[1]', 'varchar(100)')
from @table
根据文件结构进行扩展.
Extend based on structure of your file.
这篇关于如何在 SQL Server 2008 存储过程中读取配置文件键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文