--ENABLE XP_CMDSHELL===========================================================
-- To allow advanced options to be changed.
EXEC
sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC
sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
--=============================================================================
--Create Pipe-Delimited Text file
EXEC
master..xp_cmdshell
'bcp "Select * from [Bids].dbo.Employee" queryout "E:\Work Area\FOF\Iteration24\Text.txt" -t"|" -c -T -x'
--Create Xml fileEXEC
master..xp_cmdshell
'bcp "Select * from [Bids].dbo.Employee for XML auto" queryout "E:\Work Area\FOF\Iteration24\Text.xml" -c -T -x'
--DISABLE XP_CMDSHELL================================================================
-- To allow advanced options to be changed.
EXEC
sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
--To enable the feature.EXEC
sp_configure 'xp_cmdshell', 0
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
-- To allow advanced options to be changed.
EXEC
sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC
sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
--=============================================================================
--Create Pipe-Delimited Text file
EXEC
master..xp_cmdshell
'bcp "Select * from [Bids].dbo.Employee" queryout "E:\Work Area\FOF\Iteration24\Text.txt" -t"|" -c -T -x'
--Create Xml fileEXEC
master..xp_cmdshell
'bcp "Select * from [Bids].dbo.Employee for XML auto" queryout "E:\Work Area\FOF\Iteration24\Text.xml" -c -T -x'
--DISABLE XP_CMDSHELL================================================================
-- To allow advanced options to be changed.
EXEC
sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
--To enable the feature.EXEC
sp_configure 'xp_cmdshell', 0
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
No comments:
Post a Comment