我是 SQL Server 的新手,想编写一个从该 URL 获取数据的存储过程:
https://www.google.com/basepages/producttype/taxonomy.en-US.txt
看起来如下:
# Google_Product_Taxonomy_Version: 2015-02-19
Animals & Pet Supplies
Animals & Pet Supplies > Live Animals
Animals & Pet Supplies > Pet Supplies
Animals & Pet Supplies > Pet Supplies > Bird Supplies
Animals & Pet Supplies > Pet Supplies > Bird Supplies > Bird Cage Accessories
Animals & Pet Supplies > Pet Supplies > Bird Supplies > Bird Cage Accessories > Bird Cage Bird Baths
并将其插入到表中:
TABLEA (id, text)
其中 id
是自动生成的。
我知道如何进行插入部分,但是我不知道如何从指向文本文件的外部 URL 读取和解析存储过程中的数据。我怀疑它可以以某种方式加载到具有单列的“临时表”中。
不知道这是否可能,或者我需要在 C# 中处理“读取”部分,寻找一些指导....
最佳答案
你可以在你的服务器上使用 xp_cmdshell 命令吗?如果使用,可以先用shell命令将文件下载到本地
EXEC xp_cmdshell 'bitsadmin /transfer wcb /priority high https://www.google.com/basepages/producttype/taxonomy.en-US.txt f:\test.txt'
关于sql-server - SQL Server 存储过程 : Read data from URL text file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45286727/