• Sorry, but i couldnt get your problme clearly.

    Though, as per i understood, you have one batch file, say mybat.bat on c:\, which will give list of dirs. Now, you are going to execute this batch file from sql server and try to insert result into a temp table, as

    insert into tmp exec xp_cmdshell 'DIR c:\'

    If so, then you need to be clear about the output structure of your .bat file, and accordingly create temp table before executing above sql statement.

    OR

    1) change you .bat file and create output with comma saprated values.

    2) store this result into .csv file

    3) Try to import data from this .csv file into new(temp) table.

    "Don't limit your challenges, challenge your limits"