Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

access to xp_cmd results

Status
Not open for further replies.

SimonTheSponge

Programmer
Feb 12, 2001
74
GB
Is there any way to programmatically access the results of the executing an xp_cmdshell 'dir '. I receive a very nice resulting 1 column cursor containing lots of information including all my files and the details of each file, but I woiuld like to be able to fetch through this cursor to process the results. Is there any way that I can do this ?
 
Code:
create table #DIR (comments varchar (200))
declare @SQL nvarchar(50)
set @SQL = N'xp_cmdshell ''dir '''
print @SQL
insert into #DIR exec sp_executesql @SQL

select * from #dir

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top