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)
 xp_cmdshell output to a variable

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-09-13 : 00:33:22
Miguel Santiago writes "Is there any way to have the output of an xp_cmdshell command piped to a sql server variable ex:


This command does not work. What I would like to do is to populate the @filename variable with the output of the xp_cmdshell command which in this case would be a filename. Is there any way to do this.



use master
go
declare @filename varchar(255)

set @filename = xp_cmdshell 'dir *.txt'





Thanks in advance."
   

- Advertisement -