OK. That seems possible.Here's the code for the stored procedure that I am using:CREATE PROCEDURE [dbo].sp_create_File_all (@Type char(1))ASBEGIN SET NOCOUNT ON; -- Insert statements for procedure hereIF @Type='a' SELECT a.ArticleNumber, a.ArticleName, a.UnitOfMeasure, b.ArticlePriceFROM DimArticle aINNER JOIN DimPrices b ON a.ArticleNumber = b.ArticleNumberWHERE a.ArticleStatus = 1 else IF @Type='b'SELECT a.ArticleNumber, a.ArticleName, a.UnitOfMeasure, b.ArticlePrice, a.PublicationCodeFROM DimArticle aINNER JOIN DimPrices b ON a.ArticleNumber = b.ArticleNumberWHERE a.ArticleStatus = 1 else IF @Type='c'SELECT a.ArticleNumber, a.ArticleName, a.UnitOfMeasure, b.ArticlePrice, a.PublicationCode, a.PackageWeightFROM DimArticle aINNER JOIN DimPrices b ON a.ArticleNumber = b.ArticleNumberWHERE a.ArticleStatus = 1 END
And this is the BCP command that I am executing:Exec Master..xp_Cmdshell 'bcp "EXEC DB_RPT..sp_create_File_all ''a''" queryout "C:\temp\export_1.txt" -T -c'