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

Problem with xp_cmdshell Expand / Collapse
Author
Message
Posted Wednesday, January 23, 2013 3:52 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, February 20, 2014 9:07 AM
Points: 52, Visits: 131
Hi there, hope in your help.
I need to save in my hard disk the txt file generated with this code, can you help me?
thank you.

The error is:
“The configuration option ‘xp_cmdshell’ does not exist, or it may be an advanced option.”


EXEC sp_configure 'xp_cmdshell';

EXEC xp_cmdshell 'bcp "SELECT
*
FROM
tkt
" queryout "c:\temp\test.txt" -T -c -t,';

Post #1410454
Posted Thursday, January 24, 2013 1:38 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, July 8, 2014 1:59 AM
Points: 804, Visits: 1,195
-- xp_cmdshell is an advanced option, 
-- so first you need to check if it's turned on:
EXEC sp_configure;
GO

-- If you don't see xp_cmdshell in the list:
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
GO

-- Check the status of xp_cmdshell.

-- If necessary turn xp_cmdshell on:
EXEC sp_configure 'xp_cmdshell', 1;
RECONFIGURE;
GO

-- Do stuff

-- If xp_cmdshell is no longer needed:
EXEC sp_configure 'xp_cmdshell', 0;
RECONFIGURE;
GO

-- If advanced options are no longer needed:
EXEC sp_configure 'show advanced options', 0;
RECONFIGURE;
GO





Regards,
Cath

"Hang on lads, I've got a great idea. "
Michael Caine (Charlie Croker) The Italian Job
Post #1410981
Posted Thursday, January 24, 2013 2:37 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, February 20, 2014 9:07 AM
Points: 52, Visits: 131
thanks a lot!
Post #1411005
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse