• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2013
  • Last Modified:

BCP Queryout in SQL Server 2005

Ok  this works fine in server 2000  

any reason why it won't work in 2005? basically the file is not being created.


CREATE PROCEDURE dbo.exportProcFormat
@clientTable varchar (500)
AS
 
BEGIN
     DECLARE @bcpCommand VARCHAR(8000)
 

     SET @bcpCommand = 'bcp "SELECT * FROM Temp..'+@clientTable+'" queryout'
     SET @bcpCommand = @bcpCommand + ' c:\LOCATION\'+@clientTable+'.txt  -f c:\Inetpub\andrew.fmt -b 10000 -U"sa"'
     EXEC master..xp_cmdshell @bcpCommand
         
END
GO
0
abenbow
Asked:
abenbow
  • 2
1 Solution
 
ptjcbCommented:
Do you have xp_cmdshell enabled? Check Surface Configuration and see if that is true.
0
 
ptjcbCommented:
You can also turn it on with this code:

USE master
GO
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE WITH OVERRIDE
GO
EXEC sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE WITH OVERRIDE
GO
EXEC sp_configure 'show advanced options', 0
GO

xp_cmdshell is not enabled by default.
0
 
abenbowAuthor Commented:
thanks!

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now