Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

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

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

Starting Member

35 Posts

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


James K
Flowing Fount of Yak Knowledge

3873 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


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:

Edited by - russell on 03/07/2013 11:29:17
Go to Top of Page
  Previous Topic Topic Next 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.04 seconds. Powered By: Snitz Forums 2000