2012年3月22日星期四

BCP QUERYOUT from a procedure?

Anyone ever BCP QUERYOUT from a stored procedure?

Something like this? Is this even possible?

BCP "exec usp_MyProc 1, N'SomeString'" QUERYOUT c:\Output.txt -SMyServer -T -N

Did you try it before posting the question? It worked for me.

|||Sure. We do this all the times.|||

Yep. I did. No luck.

It works if I do this:

Code Snippet

bcp "declare @.str nvarchar(255); set @.str = N'SomeVar'; exec usp_MyProc 1, @.str" ...

something odd there...hmm...

|||

Works for me like this.

bcp "exec db4.dbo.get_employee 1" queryout c:\emp.txt -SSankar-P -T -c

sql

没有评论:

发表评论