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
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
EXEC master..xp_cmdshell @bcpCommand
END
GO
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks!
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.