Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bill_
Starting Member
38 Posts |
Posted - 2013-09-26 : 10:47:01
|
Want to write from a table variable to a text file from a stored procedure.Read about xp_cmdshell bcp etc. but worried because it's supposed to be a security problem and needs to be from a permanent database.Also am getting error "The EXECUTE permission was denied on the object 'xp_cmdshell'..."1. Is xp_cmdshell a bad idea to use even if I get permissions ?2. Can a "permanent" table be used in a stored procedure starting out fresh each time with 0 rows rather than use a table variable ? |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-09-26 : 11:04:02
|
You have to enable xp_cmdshell. By default it is turned off. See here for script to turn it on: http://technet.microsoft.com/en-us/library/ms190693.aspxIf you must write from stored procedure to a file, xp_cmdshell is probably the easiest option. You could use CLR stored procedures with external access instead.You can use a permanent table or table variable to query from for getting your data. That should not make any difference as far as security goes. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|