Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving xp_cmdshell data sets
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00692566
Message ID:
00692587
Views:
30
>>>We are trying to use SQL Server xp_cmdshell SP to retireve directory information using a 'DIR xxx.*' type command. This returns a result set in Query Analyzer with an nvarchar(255) column named 'output'. However, we have not been able to find documentation on how to run the command in a SP and force the result set into, say, a temporary table in order to manipulate the data. How would this be done?
>>>
>>>Thanks,
>>
>>Bill,
>>
>>I don't see anything either. However, if it's not possible, you could re-direct the output to a text file, and import it into a cursor or temporary table as a workaround.
>
>It is possible.
CREATE TABLE #temp1 (output varchar(512))
>INSERT INTO #temp1 EXEC xp_cmdshell 'dir C:\*.*'
>SELECT * FROM #temp1
Thanks for the heads up, Sergey. I'm still muddling around with T-SQL a bit and am not quite up to speed. I think this will get Bill going in the right direction.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform