Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

result in text file? Expand / Collapse
Author
Message
Posted Monday, February 10, 2014 1:33 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, October 21, 2014 8:55 AM
Points: 2,873, Visits: 5,185
Jeff Moden (2/10/2014)
MyDoggieJessie (2/10/2014)
Of course, you make valid points - I originally suggested SSIS, but provided a TSQL alternative - not pretty, but there it is...


The use of xp_CmdShell shouldn't be a problem for anyone if it's done correctly and it's pretty easy to do correctly especially security wise.


I would agree that, use of xp_CmdShell isn't a problem. However, taking in count much better methods and standard solution designs available nowadays, it would be the last thing i would use, especially for this sort of functionality...


_____________________________________________
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!"
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Post #1539933
Posted Monday, February 10, 2014 6:50 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 9:25 PM
Points: 35,372, Visits: 31,925
Eugene Elutin (2/10/2014)
Jeff Moden (2/10/2014)
MyDoggieJessie (2/10/2014)
Of course, you make valid points - I originally suggested SSIS, but provided a TSQL alternative - not pretty, but there it is...


The use of xp_CmdShell shouldn't be a problem for anyone if it's done correctly and it's pretty easy to do correctly especially security wise.


I would agree that, use of xp_CmdShell isn't a problem. However, taking in count much better methods and standard solution designs available nowadays, it would be the last thing i would use, especially for this sort of functionality...


What better methods? SSIS? PoSH? Heh... just because you can do something in SSIS or PoSH, doesn't mean you should.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1540008
Posted Tuesday, February 11, 2014 5:06 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, October 21, 2014 8:55 AM
Points: 2,873, Visits: 5,185
Jeff Moden (2/10/2014)
Eugene Elutin (2/10/2014)
Jeff Moden (2/10/2014)
MyDoggieJessie (2/10/2014)
Of course, you make valid points - I originally suggested SSIS, but provided a TSQL alternative - not pretty, but there it is...


The use of xp_CmdShell shouldn't be a problem for anyone if it's done correctly and it's pretty easy to do correctly especially security wise.


I would agree that, use of xp_CmdShell isn't a problem. However, taking in count much better methods and standard solution designs available nowadays, it would be the last thing i would use, especially for this sort of functionality...


What better methods? SSIS? PoSH? Heh... just because you can do something in SSIS or PoSH, doesn't mean you should.


It's not point to argue on general use of the xp_cmdshell (with proper security setup).
For this particular task, in my humble opinion, it is not the best option.
First of all if using with BCP out, permanent table should be used and some sort of "token" control implemented to allow for concurrent execution, which add unnecessary complexity to the simple logic.
Actually, xp_CmdShell can directly write data into file (using dos echo), but still I would not want SQL process to create such text/log files on a server...
Why not just a simple script (in whatever scripting language) which executes proc and outputs into file in a better location.
This way your proc can be executed ad-hoc to show data on screen (in SSMS), or report can be created based on this proc or whatever... Much more flexible, simpler and robust.





_____________________________________________
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!"
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Post #1540141
Posted Tuesday, February 18, 2014 12:01 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 9:25 PM
Points: 35,372, Visits: 31,925
Eugene Elutin (2/11/2014)
Why not just a simple script (in whatever scripting language) which executes proc and outputs into file in a better location.


I know it'll be viewed as a personal preference but I try to limit the number of languages used so that you don't need many "experts" nor are you in trouble if the one or two people that use the scripting language leave the company. I'm also adverse to having to use scripts rather than nice, neat stored procedures where I always know where the source code is even if someone screws up SVN.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1542389
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse