SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Create File in Windows FileSystem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

gpc44
Starting Member

35 Posts

Posted - 03/07/2013 :  10:36:42  Show Profile  Reply with Quote
Hello,
Is there a way to create a T-SQL an empty text file in the file system - no xp and sp_configure?

Regards
Nicole

James K
Flowing Fount of Yak Knowledge

3569 Posts

Posted - 03/07/2013 :  10:45:37  Show Profile  Reply with Quote
You mean without using xp_cmdshell? You could use a CLR stored procedure. (You would need to mark the stored proc for EXTERNAL_ACCESS for it to have sufficient privilege to create files in the OS file system)
Go to Top of Page

russell
Pyro-ma-ni-yak

USA
5072 Posts

Posted - 03/07/2013 :  11:28:28  Show Profile  Visit russell's Homepage  Reply with Quote
You could use sp_OACreate and create and instance of the FileSystemObject...assuming that OLE Automation is enabled and you (and the service account) have enough permissions.

Not the best idea usually though. What is it that you need to accomplish? May be a better way...


EDIT: 2nd link didn't format right...should be: http://msdn.microsoft.com/en-us/library/aa242706(v=vs.60).aspx

Edited by - russell on 03/07/2013 11:29:17
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000