if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#t') and type='U')
drop table #t
create table #t(outtext text)
insert into #t(outtext) exec master..xp_cmdshell 'dir C:/'
--exec master..xp_cmdshell 'bcp #t out c:/1.txt -c -U sa -P -S XBTDDWZ'
select * from #t
drop table #t
create table #t(outtext text)
insert into #t(outtext) exec master..xp_cmdshell 'dir C:/'
--exec master..xp_cmdshell 'bcp #t out c:/1.txt -c -U sa -P -S XBTDDWZ'
select * from #t