如何将文件从Visual Studio数据库项目复制到SQL Server文件系统? [英] How can I copy files from my Visual Studio Database project to the SQL Server file system?

查看:185
本文介绍了如何将文件从Visual Studio数据库项目复制到SQL Server文件系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想运行BULK INSERT命令从我的数据库项目加载数据(部署后)。 但是BULK INSERT命令需要使用SQL Server本地的文件。 制表符分隔的数据文件和格式文件位于另一台服务器上的
数据库项目中。 作为构建的一部分,如何将文件复制到SQL Server的文件系统,然后执行BULK INSERT?

解决方案

尝试打开项目属性窗口,选择Build Events,并在Pre-build事件中添加MSBuild任务。在预构建事件中,您可以将必要的文件复制到本地SQL Server,以便可以运行BULK INSERT。检查:  http://msdn.microsoft.com/en-us/library /ms171466.aspx

I would like to run a BULK INSERT command to load data from my database project (post-deployment).  But the BULK INSERT command needs to work with files that are local to the SQL Server.  The tab delimited data file and format file are in my database project on another server.  As part of the build, how can I copy the files to the file system of the SQL Server and then do the BULK INSERT?

解决方案

Try open project property window, choose Build Events, and add a MSBuild task in the Pre-build event. In the pre-build event, you can copy the necessary file to your local SQL Server, so that the BULK INSERT can run. Check: http://msdn.microsoft.com/en-us/library/ms171466.aspx


这篇关于如何将文件从Visual Studio数据库项目复制到SQL Server文件系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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