Sql 2008 code to open file
What is the SQL 2008 code to open a file, appen开发者_如何学JAVAd some new lines, and save the file. Is there a way to do this all inside a stored procedure? Also, is there a way to automatically retrieve the script to do this from a "Tasks"->"Generate Scripts" menu options, or at least get close.
You can do it with plain T-SQL...
http://www.simple-talk.com/sql/t-sql-programming/reading-and-writing-files-in-sql-server-using-t-sql/
to make it work, click on those links in the text as well...
http://www.simple-talk.com/code/WorkingWithFiles/uftReadFileAsTable.txt
http://www.simple-talk.com/code/WorkingWithFiles/spWriteStringTofile.txt
Or you might write a function in c#...
http://blog.adampresley.com/2009/writing-csharp-functions-for-sql-server-and-clr-integration/
精彩评论