Link to home
Start Free TrialLog in
Avatar of abenbow
abenbow

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of ptjcb
ptjcb
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of abenbow
abenbow

ASKER

thanks!