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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Handle xp_cmdshell return values

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-09-11 : 14:10:28
jp_schwartz writes "Hi !!!

I´m using xp_cmdshell. When I execute it, it performs the task I asked correctly, and returns some rows. I need those rows, or at least the count of them. It could be variables, or a table... anything.

OS: WinNT
SQL Server 7.0

Thanks in advance"

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-09-11 : 14:50:26
you can insert the results into a temp table
e.g.


create table #output(data varchar(255))

insert #output
exec master.dbo.xp_cmdshell 'dir /B /A-D c:\windows'
select @@rowcount-1 --Get rid of the single NULL

drop table #output



HTH
Jasper Smith
Go to Top of Page
   

- Advertisement -