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 |
|
visa123
Yak Posting Veteran
54 Posts |
Posted - 2010-09-29 : 02:46:48
|
| HiI have to open a batch file automatically in sql. So i have used the below command.EXECUTE master.dbo.xp_cmdshell 'D:\Databases\batch\123.bat'Its worked for few times. After that its not working.One time i have stopped before the process is complete.May be this is the issue.Now its returns null value.Can anyone help me how can i open the file in sql.Visa.G |
|
|
visa123
Yak Posting Veteran
54 Posts |
Posted - 2010-09-29 : 05:36:34
|
| HiI have used the below code to enable the xp_cmdshell.EXEC sp_configure 'show advanced options', 1GORECONFIGUREGOEXEC sp_configure 'xp_cmdshell', 1But when i execute the below statement it returns NULL value only.Can anyone help me?EXECUTE master.dbo.xp_cmdshell 'D:\Databases\batch\123.bat'ThanksVisa.G |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-09-29 : 05:56:46
|
| Does this path 'D:\Databases\batch\123.bat' exists on the SQL server?PBUH |
 |
|
|
visa123
Yak Posting Veteran
54 Posts |
Posted - 2010-09-29 : 07:43:58
|
| HiYes.The Path is Exists.I have checked manually to open batch file in this path.It working fine.But through that 'xp_cmdshell' it is not working.ThanksVisa.G |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-09-29 : 08:00:46
|
| Are you running xp_cmdshell under sysadmin?PBUH |
 |
|
|
visa123
Yak Posting Veteran
54 Posts |
Posted - 2010-09-29 : 08:22:46
|
| Yes sysadmin onlyVisa.G |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-09-29 : 09:27:02
|
| are you getting an error? what does the batch file do? |
 |
|
|
visa123
Yak Posting Veteran
54 Posts |
Posted - 2010-09-29 : 09:33:08
|
| i am not getting any Error.The output is showing NULL.The batch file open One url ( that is Transferring the data for Our client request ).If i open the batch manually , its fine.but through this cmdshell returing null output.Visa.G |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-09-29 : 09:41:51
|
| is the batch file executing? |
 |
|
|
visa123
Yak Posting Veteran
54 Posts |
|
|
|
|
|