How to Execute an Operating System Command From Within SQL
Server ?

Answers were Sorted based on User's Feedback



How to Execute an Operating System Command From Within SQL Server ?..

Answer / sanjeev kumar

If your server is not configured for "xp_cmdshell" command
then at first you need to reconfigure for that. To
reconfigure, execute the following:-

sp_CONFIGURE 'xp_cmdshell', 1
GO
RECONFIGURE
GO

Then execute the following:-

EXEC master.dbo.xp_cmdshell 'Dir c:\'


Regards
Sanjeev kumar
Contact If your problem are still not solved.
thanks
skdeveloper0@gmail.com

Is This Answer Correct ?    4 Yes 0 No

How to Execute an Operating System Command From Within SQL Server ?..

Answer / guest

The xp_cmdshell extended store procedure makes it possible
to execute operating system commands from within SQL
Server.
Example:

EXEC Master..xp_cmdshell 'Dir c:\'

Is This Answer Correct ?    3 Yes 0 No

How to Execute an Operating System Command From Within SQL Server ?..

Answer / thatiparthi brahma reddy

EXEC Master.dbo.xp_cmdshell 'Dir d:\'

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More SQL Server Interview Questions

how to insert the values in 5 table at a time with triggers . if u have any solution then co-operate me ?

1 Answers  


Well sometimes sp_reanmedb may not work you know because if some one is using the db it will not accept this command so what do you think you can do in such cases?

2 Answers  


What is the difference between delete and truncate statements?

0 Answers  


Why Do you want to work in this company?

4 Answers   HCL,


What are the differences between sql server and mysql.

0 Answers  






Tell me what are the advantages of using stored procedures?

0 Answers  


What is the system function to get the current user's user id?

2 Answers   HCL,


Explian different types of BACKUPs avaialabe in SQL Server? Given a particular scenario, how would you go about choosing a backup plan?

2 Answers   HCL,


What is lock escalation and what is its purpose?

0 Answers  


What do you understand by the denormalisation?

0 Answers  


How to get number of days in a given year?

4 Answers   ADP,


What is the syntax to execute the sys.dm_db_missing_index_details?

0 Answers  


Categories