SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Problem with xp_cmdshell


Problem with xp_cmdshell

Author
Message
cms9651
cms9651
SSC-Enthusiastic
SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)

Group: General Forum Members
Points: 140 Visits: 144
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,';


Cath Trimble
Cath Trimble
SSC Eights!
SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)SSC Eights! (945 reputation)

Group: General Forum Members
Points: 945 Visits: 1196
-- 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
cms9651
cms9651
SSC-Enthusiastic
SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)SSC-Enthusiastic (140 reputation)

Group: General Forum Members
Points: 140 Visits: 144
thanks a lot!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search