Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

How to return BCP dir command output into multiple columns?

$
0
0

I have a list of files in multiple folders in F:\ClientData\DocumentsTEST\guidsTest 

This query gives me a full filepath for each file  in a single column:

EXEC xp_cmdshell 'dir F:\ClientData\DocumentsTEST\guidsTest /b /s /a-d'

This query gives me attributes, but without the fullpath

EXEC xp_cmdshell 'dir F:\ClientData\DocumentsTEST\guidsTest /s /o /-c /a-d'

In the second case I could parse the data into separate columns based on string position, but that doesn't solve my problem. 

What I need is the FullPath and the rest of the parameters returned by the SAME QUERY.

I tried running 2 separate bcp queries and then matching the fullpath based on filename, but filenames can be repetitive - so can't use that solution.

Can anyone help me please?




Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>