March 7, 2013 at 12:54 pm
Hello,
Is there a way to create a text file in the file system (Win) without xp_cmdshell / sp_configure?
Regards
Nicole 😉
March 7, 2013 at 12:59 pm
We'll need a bit more information. I can assume you are trying to export a result set, but I don't like to assume. Simple answer... is yes.
Jared
CE - Microsoft
March 7, 2013 at 1:09 pm
The Last Statement in a Stored-Procedure is "Create File C:\tmp\trigger.txt in FileSystem".
This File is a TriggerFile for a Job. This Job ping every Minute ( if File exists then Start Processing a another Job).
That's all.
Regards
Nicole
😉
March 7, 2013 at 1:14 pm
Well, in your case... Why not just have the procedure start the job? Other option is to execute an SSIS package, but that seems to be a lot of work for something so simple.
Jared
CE - Microsoft
March 7, 2013 at 9:36 pm
A SQLCLR object can access the file system too, and it would be the lesser of two evils in this case, when compared to enabling xp_cmdshell, but still not ideal. Accessing the file system from T-SQL is just bad form in my opinion.
I like the idea of having the proc start a job, if in fact "the job" you mentioned is an Agent Job and you were not referring to some external process to SQL Server watching a directory for a file to arrive.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
March 7, 2013 at 10:05 pm
From the sounds of it, this is something that I'd prefer to have monitored from the task scheduler or from the OS or a service that is fairly lightweight.
That said, you can create the file, and/or kick off a sql agent job if you chose to use Powershell instead.
Powershell is lightweight and seems like the right tool for this kind of requirement.
Here is a simple article on creating a file
And here is one on running a SQL Agent job from a Powershell script
http://kevine323.blogspot.com/2012/01/starting-sql-agent-job-with-powershell.html
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply